My Book
-
Recent Posts
Archives
- January 2019
- May 2017
- April 2017
- January 2017
- November 2016
- October 2016
- July 2016
- June 2016
- May 2016
- April 2016
- February 2016
- December 2015
- November 2015
- April 2015
- March 2015
- November 2014
- September 2014
- July 2014
- June 2014
- January 2014
- November 2013
- October 2013
- September 2013
- June 2013
- March 2013
- January 2013
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- November 2011
- October 2011
- July 2011
- May 2011
- April 2011
- January 2011
- November 2010
- October 2010
- September 2010
Categories
- Android
- Auto Layout
- Books
- CocoaTouch
- Debugging
- Genetic Algorithms
- Interface Builder
- iOS 6
- iOS Programming for .NET Developers
- iOS7
- iOS8
- Jobs
- MacBook Pro
- MonoTouch
- Networking
- Objective-C
- Streaming Media
- Sustainable Coding
- Swift
- Thoughts
- Tic-tac-toe
- Tips and Tricks
- Two Letters
- UICollectionView
- UITableView
- Uncategorized
- User Experience
- XCode 3
- Xcode 4
Meta
Author Archives: Josh Smith
Command line calculator in Swift 4.2
I just published a command line calculator written in Swift 4.2 with a big README explaining how it all works. What a fun challenge! Enjoy… https://github.com/ijoshsmith/command-line-calculator
Simple deep linking in Swift
If you need to support deep links with a custom URL scheme in your iOS or tvOS app, check out my tidy little API to help convert URLs into deep link objects. It’s written in Swift 3. I published it on … Continue reading
Reflectable enums in Swift 3
Suppose you are working on a Swift program that needs a data model to represent a contact, such as a person from the user’s address book or a FaceBook friend. You might start off by modeling this as a Contact … Continue reading
Generate Equatable code in Swift
Here is my Swift 3 utility function for turning a live class/struct instance into Equatable protocol code for that type: https://github.com/ijoshsmith/equatable-code-generator Here’s to never writing that kind of code ever again!
Function composition in Swift
The way that functional programming languages allow functions to be combined can help make code easier to read and understand. The technique is known as function composition. I show how to compose functions in Swift 3 using custom operators, including a … Continue reading
json2swift: a peek under the hood
This article presents a high-level overview of how my json2swift tool works. Several people have expressed interest in using my code as the foundation for a similar tool, or just want to change the Swift code it generates, and have asked … Continue reading
Swift JSON library vs. code generation
Ever since Swift was first released there has been an endless stream of new libraries to simplify writing Swift code that consumes JSON data. Since this is such a common and tedious aspect of developing apps, it’s an important topic … Continue reading
Posted in Swift
6 Comments
Create Swift data models from JSON
I published a tool that analyzes JSON data and generates Swift data model code, named json2swift. This tool helps eliminate most of the error-prone grunt work involved with consuming JSON data in a Swift app. The repository’s README has more … Continue reading
Concealment design pattern in Swift
This article introduces a design pattern that I call Concealment, and demonstrates how to use the pattern in Swift code. Purpose The Concealment pattern enables types to support novel, related functionality without adding nonessential members to their interface. Motivation User-defined types can easily be overused in a codebase, giving more prominence to … Continue reading
Analyzing a dependency graph in Swift
I published my solution to Dave Thomas’s Transitive Dependencies programming exercise, known as a kata, to GitHub: https://github.com/ijoshsmith/transitive-dependencies-kata The Challenge This exercise involves analyzing a graph data structure which contains nodes that “depend on” other nodes. A graph is represented as direct dependencies between nodes: The objective is to find all … Continue reading