I rarely use comments when I’m coding1. I do make one exception though; using
// FIXME:to highlight pieces of code I need to revisit at a later date.
Jeffrey Sambells wrote a post on how to flag these comments as Xcode warnings but that only applies for Objective-C. With a slight tweak, here is a run script build phase for flagging TODO: and FIXME: as warnings in a Swift project.
Russ Bishop on capture lists for closures in Swift:
Most people aren’t aware that you can create new named values here… This avoids polluting the surrounding code…
Two interesting articles about Monads in the context of Swift programming language. If you are into functional programming you should definitely read the “conversation” between those two developers.
Syntax can become extremely verbose when working with many APIs in the iOS SDK with Swift, and Quartz is no exception.
Here’s a library that provides a more convenient syntax when using Swift with Quartz and related frameworks such as Core Image, and Core Graphics called SwiftGraphics from Jonathan Wight.
Here’s some of the features provided by SwiftGraphics:
- Operator overloading for CoreGraphics types
- Quadtree data structures
- Object oriented extensions for CGContext and CGPath
- Easy creation of geometry objects
- Convex hull generation
- An Xcode 6 playground
Here’s a nice straightforward (about 35 minutes) step-by-step video tutorial series that explains how to create a simple Dribbble client app using UICollectionView submitted by Tope Abayomi.
Specifically in the series you’ll learn how to:
- Get your Dribbble key
- Use NSURLSession to download data from Dribbble
- Parse the JSON response from the Dribbble API in Swift
- Display the downloaded data and images in a UICollectionView
- Load the images asynchronously
There’s a chance you’ve heard a term floating around with some of the more functional-minded languages. The term is “curry” and not only is it a delicious Southeastern Asian cuisine, it also refers to translating the evaluation of a function that takes multiple arguments into evaluating a sequence of functions, each with a single argument. Obviously.
Let’s take a quick walk through the world of function currying in Swift, figure out what that nonsense above really means, and then see how we could use this technique in the real world.
CocoaMarkdown is a cross-platform framework for parsing and rendering Markdown, built on top of the C reference implementation of CommonMark.
Working with UITableView requires a lot of boilerplate code and here’s a helper library for working with UITableView submitted by Le Van Nghia called MyTableViewManager.
MyTableViewManger was created to reduce the code required when using UITableView allowing table view management with UITableViewDelegate and UITableViewDataSource and some other nice features.
Some of the features of MyTableViewManager include:
- Easy updating of cells
- Dynamic cell height support
- Header/Footer view support
- Load more support
- Support for interface builder
An example project is included and there are a number of usage examples in the readme.
Dabble in Swift for long and the functional programming paradigm will most certainly appear on your radar. From conferences to books to blog posts, I’ve seen a lot in the functional programming arena as it relates to Swift.
As I seek to improve my functional programming thought processes and to practice what I’m learning, I found myself struggling with a fundamental concept: immutability. Especially when I’m designing something that, at the very least, appears to require the ability to change state at some point in time.