profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/calda/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Cal Stephens calda iOS Engineer San Francisco, California https://calstephens.tech iOS engineer @airbnb. Previously @apple, @mailchimp, @gatech.

calda/CGPathIntersection 30

:curly_loop: A CoreGraphics library that identifies points where two CGPaths intersect.

calda/Airline-Logos 18

Logos for most major world airlines & a downloader script

calda/Brainy-Phonics 10

🐦 An educational game that teaches basic reading skills and word recognition. Published by Augusta University.

calda/Blurb 7

:droplet: An iOS image editor that lets you create square images with blurry backgrounds

calda/Emoji-Names 6

:smile: An iOS app that reveals the unicode names of emoji

calda/Emoji-Sudoku 5

:watch: Sudoku app for watchOS and iOS

calda/AdaptiveFormSheet 4

:arrow_up: A Modal Presentation Controller that adapts to content size, keyboard visibility, and touch input.

calda/CodingKeyPath 3

Add support for Encoding and Decoding nested objects with dot notation (Prototype implementation for the Swift Standard Library)

calda/DeclarativeTableViewController 3

🏗 A simple, declarative approach to building Table Views in Swift. Define your cells and go.

calda/calstephens.tech 2

👨🏼‍💻 My personal website / blog / portfolio

startedcalda/CGPathIntersection

started time in 3 hours

Pull request review commentairbnb/swift

Add rule to prefer shorthand form for Optional, Array, and Dictionary

 _You can enable the following settings in Xcode by running [this script](resourc    </details> +  * <a id='standard-library-type-shorthand'></a>(<a href='#standard-library-type-sugar'>link</a>) **For standard library types with a canonical shorthand form (`Optional`, `Array`, `Dictionary`), prefer using the shorthand form over the full generic form. [![SwiftFormat: typeSugar](https://img.shields.io/badge/SwiftFormat-typeSugar-7B0051.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#typeSugar)++  <details>++  ```swift+  // WRONG+  let optional: Optional<String> = nil+  let array: Array<String> = []+  let dictionary: Dictionary<String, Any> = [:]++  // RIGHT+  let optional: String? = nil+  let array: [String] = []+  let dictionary: [String: Any] = [:]

Yes, I was mistaken.

calda

comment created time in 15 hours

Pull request review commentairbnb/swift

Add rule to prefer shorthand form for Optional, Array, and Dictionary

 _You can enable the following settings in Xcode by running [this script](resourc    </details> +  * <a id='standard-library-type-shorthand'></a>(<a href='#standard-library-type-sugar'>link</a>) **For standard library types with a canonical shorthand form (`Optional`, `Array`, `Dictionary`), prefer using the shorthand form over the full generic form. [![SwiftFormat: typeSugar](https://img.shields.io/badge/SwiftFormat-typeSugar-7B0051.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#typeSugar)

I think the format is off here too 😉

calda

comment created time in 19 hours

Pull request review commentairbnb/swift

Add rule to prefer shorthand form for Optional, Array, and Dictionary

 _You can enable the following settings in Xcode by running [this script](resourc    </details> +  * <a id='standard-library-type-shorthand'></a>(<a href='#standard-library-type-sugar'>link</a>) **For standard library types with a canonical shorthand form (`Optional`, `Array`, `Dictionary`), prefer using the shorthand form over the full generic form. [![SwiftFormat: typeSugar](https://img.shields.io/badge/SwiftFormat-typeSugar-7B0051.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#typeSugar)++  <details>++  ```swift+  // WRONG+  let optional: Optional<String> = nil+  let array: Array<String> = []+  let dictionary: Dictionary<String, Any> = [:]++  // RIGHT+  let optional: String? = nil+  let array: [String] = []+  let dictionary: [String: Any] = [:]

I'm not sure I agree. These types cannot be inferred from the right hand side. I'd agree if the examples were using let array: [String] = Array<String>() but as is they need the explicit types.

calda

comment created time in 19 hours

Pull request review commentairbnb/swift

Add rule to prefer shorthand form for Optional, Array, and Dictionary

 _You can enable the following settings in Xcode by running [this script](resourc    </details> +  * <a id='standard-library-type-shorthand'></a>(<a href='#standard-library-type-sugar'>link</a>) **For standard library types with a canonical shorthand form (`Optional`, `Array`, `Dictionary`), prefer using the shorthand form over the full generic form. [![SwiftFormat: typeSugar](https://img.shields.io/badge/SwiftFormat-typeSugar-7B0051.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#typeSugar)++  <details>++  ```swift+  // WRONG+  let optional: Optional<String> = nil+  let array: Array<String> = []+  let dictionary: Dictionary<String, Any> = [:]++  // RIGHT+  let optional: String? = nil+  let array: [String] = []+  let dictionary: [String: Any] = [:]

These examples violate this rule. Maybe we can use a different example?

calda

comment created time in 19 hours

Pull request review commentairbnb/swift

Add rule to prefer shorthand form for Optional, Array, and Dictionary

 --swiftversion 5.1  # rules---rules anyObjectProtocol,redundantParens,redundantReturn,redundantSelf,sortedImports,strongifiedSelf,trailingCommas,trailingSpace,wrapArguments,wrapMultilineStatementBraces,indent,wrapAttributes,organizeDeclarations,markTypes,extensionAccessControl,duplicateImports,redundantType+--rules anyObjectProtocol,redundantParens,redundantReturn,redundantSelf,sortedImports,strongifiedSelf,trailingCommas,trailingSpace,wrapArguments,wrapMultilineStatementBraces,indent,wrapAttributes,organizeDeclarations,markTypes,extensionAccessControl,duplicateImports,redundantType,typeSugar

Do you think it would be good to always specify the values to SwiftFormat (e.g. --short-optionals always) to avoid relying on SwiftFormat defaults which may change? I'm of mixed minds.

calda

comment created time in 19 hours

Pull request review commentairbnb/swift

Add rule to always inline let keyword when destructuring enum cases and tuples

 _You can enable the following settings in Xcode by running [this script](resourc    </details> +* <a id='destructure-inline-let'></a> (<a href='#destructure-inline-let'>link</a>) **When destructuring an enum case or a tuple, place the `let` keyword inline, adjacent to each individual property assignment.** [![SwiftFormat: hoistPatternLet](https://img.shields.io/badge/SwiftFormat-hoistPatternLet-7B0051.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#hoistPatternLet)

Putting here so we have a thread:

  1. This makes it more clear which identifiers are part of the conditional (if / case) check and which identifiers are binding new variables.

I am open to this idea though it would be easier to visualize. What do you think about adding a code example where we bind new variables to show how the proposed style is superior?

calda

comment created time in 19 hours

Pull request review commentairbnb/swift

Add rule to always inline let keyword when destructuring enum cases and tuples

 _You can enable the following settings in Xcode by running [this script](resourc    </details> +* <a id='destructure-inline-let'></a> (<a href='#destructure-inline-let'>link</a>) **When destructuring an enum case or a tuple, place the `let` keyword inline, adjacent to each individual property assignment.** [![SwiftFormat: hoistPatternLet](https://img.shields.io/badge/SwiftFormat-hoistPatternLet-7B0051.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#hoistPatternLet)

Putting here so we have a thread:

  1. For consistency, we should prefer either always inlining the let keywords, or never inlining the keywords. Since enum payloads with a small number of associated values are much more common than enum payloads with a large number of associated values, we should prefer always inlining the let keywords.

For an enum with one associated value, the number of characters is the same in either style. For an enum with multiple associated values, the proposed style is more verbose. I don't follow how this proposed style prioritizes enum cases with fewer associated values.

calda

comment created time in 19 hours

pull request commentairbnb/swift

Add rule to always inline let keyword when destructuring enum cases and tuples

I am having trouble following 3) in the reasoning. Can you make it more clear to me?

calda

comment created time in 19 hours

Pull request review commentairbnb/swift

Adopt consecutiveSpaces rule

 _You can enable the following settings in Xcode by running [this script](resourc    </details> -* <a id='limit-vertical-whitespace'></a>(<a href='#limit-vertical-whitespace'>link</a>) **Limit empty vertical whitespace to one line.** Favor the following formatting guidelines over whitespace of varying heights to divide files into logical groupings. [![SwiftLint: vertical_whitespace](https://img.shields.io/badge/SwiftLint-vertical__whitespace-007A87.svg)](https://github.com/realm/SwiftLint/blob/master/Rules.md#vertical-whitespace)+* <a id='limit-consecutive-whitespace'></a>(<a href='#limit-consecutive-whitespace'>link</a>) **Limit consecutive whitespace to one blank line or space (excluding indentation).** Favor the following formatting guidelines over whitespace of varying heights of widths to divide files into logical groupings. [![SwiftLint: vertical_whitespace](https://img.shields.io/badge/SwiftLint-vertical__whitespace-007A87.svg)](https://github.com/realm/SwiftLint/blob/master/Rules.md#vertical-whitespace) [![SwiftFormat: consecutiveSpaces](https://img.shields.io/badge/SwiftFormat-consecutiveSpaces-008489.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#consecutiveSpaces)
* <a id='limit-consecutive-whitespace'></a>(<a href='#limit-consecutive-whitespace'>link</a>) **Limit consecutive whitespace to one blank line or space (excluding indentation).** Favor the following formatting guidelines over whitespace of varying heights or widths. [![SwiftLint: vertical_whitespace](https://img.shields.io/badge/SwiftLint-vertical__whitespace-007A87.svg)](https://github.com/realm/SwiftLint/blob/master/Rules.md#vertical-whitespace) [![SwiftFormat: consecutiveSpaces](https://img.shields.io/badge/SwiftFormat-consecutiveSpaces-008489.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#consecutiveSpaces)
calda

comment created time in 20 hours

Pull request review commentairbnb/swift

Adopt consecutiveSpaces rule

 _You can enable the following settings in Xcode by running [this script](resourc    </details> -* <a id='limit-vertical-whitespace'></a>(<a href='#limit-vertical-whitespace'>link</a>) **Limit empty vertical whitespace to one line.** Favor the following formatting guidelines over whitespace of varying heights to divide files into logical groupings. [![SwiftLint: vertical_whitespace](https://img.shields.io/badge/SwiftLint-vertical__whitespace-007A87.svg)](https://github.com/realm/SwiftLint/blob/master/Rules.md#vertical-whitespace)+* <a id='limit-consecutive-whitespace'></a>(<a href='#limit-consecutive-whitespace'>link</a>) **Limit consecutive whitespace to one blank line or space (excluding indentation).** Favor the following formatting guidelines over whitespace of varying heights of widths to divide files into logical groupings. [![SwiftLint: vertical_whitespace](https://img.shields.io/badge/SwiftLint-vertical__whitespace-007A87.svg)](https://github.com/realm/SwiftLint/blob/master/Rules.md#vertical-whitespace) [![SwiftFormat: consecutiveSpaces](https://img.shields.io/badge/SwiftFormat-consecutiveSpaces-008489.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#consecutiveSpaces)

Dividing files seems less relevant now.

calda

comment created time in 20 hours

Pull request review commentairbnb/swift

Adopt consecutiveSpaces rule

 _You can enable the following settings in Xcode by running [this script](resourc    </details> -* <a id='limit-vertical-whitespace'></a>(<a href='#limit-vertical-whitespace'>link</a>) **Limit empty vertical whitespace to one line.** Favor the following formatting guidelines over whitespace of varying heights to divide files into logical groupings. [![SwiftLint: vertical_whitespace](https://img.shields.io/badge/SwiftLint-vertical__whitespace-007A87.svg)](https://github.com/realm/SwiftLint/blob/master/Rules.md#vertical-whitespace)+* <a id='limit-consecutive-whitespace'></a>(<a href='#limit-consecutive-whitespace'>link</a>) **Limit consecutive whitespace to one blank line or space (excluding indentation).** Favor the following formatting guidelines over whitespace of varying heights to divide files into logical groupings. [![SwiftLint: vertical_whitespace](https://img.shields.io/badge/SwiftLint-vertical__whitespace-007A87.svg)](https://github.com/realm/SwiftLint/blob/master/Rules.md#vertical-whitespace) [![SwiftFormat: consecutiveSpaces](https://img.shields.io/badge/SwiftFormat-consecutiveSpaces-008489.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#consecutiveSpaces)++  <details>++  ```swift+  // WRONG+  struct Planet {++    let mass:       Double+    let satellites: [Planet]
    let nearestNeighbor: Planet

?

calda

comment created time in 20 hours

Pull request review commentairbnb/swift

Adopt consecutiveSpaces rule

 _You can enable the following settings in Xcode by running [this script](resourc    </details> -* <a id='limit-vertical-whitespace'></a>(<a href='#limit-vertical-whitespace'>link</a>) **Limit empty vertical whitespace to one line.** Favor the following formatting guidelines over whitespace of varying heights to divide files into logical groupings. [![SwiftLint: vertical_whitespace](https://img.shields.io/badge/SwiftLint-vertical__whitespace-007A87.svg)](https://github.com/realm/SwiftLint/blob/master/Rules.md#vertical-whitespace)

One of the reasons we've named these links is so that each rule has a permalink. When we created the style guide we were told this was a good idea by the folk working on the JS style guide. With this PR, the https://github.com/airbnb/swift#limit-vertical-whitespace permalink breaks. Is there any way to continue to have https://github.com/airbnb/swift#limit-vertical-whitespace bring us to this rule?

calda

comment created time in 20 hours

Pull request review commentairbnb/swift

Add rule to always inline let keyword when destructuring enum cases and tuples

 _You can enable the following settings in Xcode by running [this script](resourc    </details> +* <a id='destructure-inline-let'></a> (<a href='#destructure-inline-let'>link</a>) **When destructuring an enum case or a tuple, place the `let` keyword inline, adjacent to each individual property assignment.** [![SwiftFormat: hoistPatternLet](https://img.shields.io/badge/SwiftFormat-hoistPatternLet-7B0051.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#hoistPatternLet)++  <details>

Let's add the reasoning to the rule itself too 🙏

calda

comment created time in 21 hours

Pull request review commentairbnb/swift

Add rule to always inline let keyword when destructuring enum cases and tuples

 _You can enable the following settings in Xcode by running [this script](resourc    </details> +* <a id='destructure-inline-let'></a> (<a href='#* <a id='destructure-inline-let'></a> (<a href='#unnecessary-enum-arguments'>link</a>) **When destructuring an enum case or a tuple, place the `let` keyword inline, adjacent to each individual property assignment.** [![SwiftFormat: hoistPatternLet](https://img.shields.io/badge/SwiftFormat-hoistPatternLet-7B0051.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#hoistPatternLet)

the format of the links at the beginning is off :P

calda

comment created time in 21 hours

Pull request review commentairbnb/swift

Adopt consecutiveSpaces rule

 _You can enable the following settings in Xcode by running [this script](resourc    </details> -* <a id='limit-vertical-whitespace'></a>(<a href='#limit-vertical-whitespace'>link</a>) **Limit empty vertical whitespace to one line.** Favor the following formatting guidelines over whitespace of varying heights to divide files into logical groupings. [![SwiftLint: vertical_whitespace](https://img.shields.io/badge/SwiftLint-vertical__whitespace-007A87.svg)](https://github.com/realm/SwiftLint/blob/master/Rules.md#vertical-whitespace)+* <a id='limit-consecutive-whitespace'></a>(<a href='#limit-consecutive-whitespace'>link</a>) **Limit consecutive whitespace to one blank line or space (excluding indentation).** Favor the following formatting guidelines over whitespace of varying heights to divide files into logical groupings. [![SwiftLint: vertical_whitespace](https://img.shields.io/badge/SwiftLint-vertical__whitespace-007A87.svg)](https://github.com/realm/SwiftLint/blob/master/Rules.md#vertical-whitespace) [![SwiftFormat: consecutiveSpaces](https://img.shields.io/badge/SwiftFormat-consecutiveSpaces-008489.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#consecutiveSpaces)++  <details>++  ```swift+  // WRONG+  struct Planet {++    let mass:       Double+    let satellites: [Planet]

The nerd in me wants to point out that satellites are actually not planets. But I won't do it.

calda

comment created time in 21 hours

Pull request review commentairbnb/swift

Adopt consecutiveSpaces rule

 _You can enable the following settings in Xcode by running [this script](resourc    </details> -* <a id='limit-vertical-whitespace'></a>(<a href='#limit-vertical-whitespace'>link</a>) **Limit empty vertical whitespace to one line.** Favor the following formatting guidelines over whitespace of varying heights to divide files into logical groupings. [![SwiftLint: vertical_whitespace](https://img.shields.io/badge/SwiftLint-vertical__whitespace-007A87.svg)](https://github.com/realm/SwiftLint/blob/master/Rules.md#vertical-whitespace)+* <a id='limit-consecutive-whitespace'></a>(<a href='#limit-consecutive-whitespace'>link</a>) **Limit consecutive whitespace to one blank line or space (excluding indentation).** Favor the following formatting guidelines over whitespace of varying heights to divide files into logical groupings. [![SwiftLint: vertical_whitespace](https://img.shields.io/badge/SwiftLint-vertical__whitespace-007A87.svg)](https://github.com/realm/SwiftLint/blob/master/Rules.md#vertical-whitespace) [![SwiftFormat: consecutiveSpaces](https://img.shields.io/badge/SwiftFormat-consecutiveSpaces-008489.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#consecutiveSpaces)
* <a id='limit-consecutive-whitespace'></a>(<a href='#limit-consecutive-whitespace'>link</a>) **Limit consecutive whitespace to one blank line or space (excluding indentation).** Favor the following formatting guidelines over whitespace of varying heights or widths to divide files into logical groupings. [![SwiftLint: vertical_whitespace](https://img.shields.io/badge/SwiftLint-vertical__whitespace-007A87.svg)](https://github.com/realm/SwiftLint/blob/master/Rules.md#vertical-whitespace) [![SwiftFormat: consecutiveSpaces](https://img.shields.io/badge/SwiftFormat-consecutiveSpaces-008489.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#consecutiveSpaces)
calda

comment created time in 21 hours

Pull request review commentairbnb/swift

Adopt consecutiveSpaces rule

 _You can enable the following settings in Xcode by running [this script](resourc    </details> -* <a id='limit-vertical-whitespace'></a>(<a href='#limit-vertical-whitespace'>link</a>) **Limit empty vertical whitespace to one line.** Favor the following formatting guidelines over whitespace of varying heights to divide files into logical groupings. [![SwiftLint: vertical_whitespace](https://img.shields.io/badge/SwiftLint-vertical__whitespace-007A87.svg)](https://github.com/realm/SwiftLint/blob/master/Rules.md#vertical-whitespace)+* <a id='limit-consecutive-whitespace'></a>(<a href='#limit-consecutive-whitespace'>link</a>) **Limit consecutive whitespace to one blank line or space (excluding indentation).** Favor the following formatting guidelines over whitespace of varying heights to divide files into logical groupings. [![SwiftLint: vertical_whitespace](https://img.shields.io/badge/SwiftLint-vertical__whitespace-007A87.svg)](https://github.com/realm/SwiftLint/blob/master/Rules.md#vertical-whitespace) [![SwiftFormat: consecutiveSpaces](https://img.shields.io/badge/SwiftFormat-consecutiveSpaces-008489.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#consecutiveSpaces)++  <details>++  ```swift+  // WRONG+  struct Planet {++    let mass:       Double+    let satellites: [Planet]+++    func travelTo() { }

nit: from the name of this method I would expect it to take a parameter. Could we a different name/signature?

    func distance(to: Planet) -> Double { }
calda

comment created time in 21 hours

startedsegmentio/ksuid

started time in 3 days

startedmitchtabian/Food2Fork-KMM

started time in 4 days

startedvogon/everycolor

started time in 4 days

release gonzalonunez/Skeleton

0.5.1

released time in 4 days

issue commentairbnb/swift

Please Add SwiftUI style guide for Swift World 🚀

Hi @keshavvishwkarma! Thanks for participating in our style guide repo discussions 😉

I personally like the idea of having style recommendations on SwiftUI usage so we can move towards having best practices in the community, but given that:

  1. SwiftUI is still a very early technology
  2. We (Airbnb) don't currently use SwiftUI in production

I think we won't move in this direction for the time being.

When / if we start using SwiftUI in production for a while and we've seen how both the Airbnb iOS community and the larger iOS community think of style in SwiftUI I think we should definitively start adding recommendations in that direction.

In the short term we've been quite happy with using Epoxy for our declarative UI, so I don't expect changes on this in the short-term.

keshavvishwkarma

comment created time in 7 days

issue openedairbnb/swift

Please Add SwiftUI style guide for Swift World 🚀

A style guide for the SwiftUI domain-specific language would be a nice addition to Airbnb's Swift style guide for the Swift World 🚀

created time in 7 days

startedandymatuschak/orbit

started time in 8 days

pull request commentairbnb/swift

Add "prefer immutable statics" rule

Thank you Eric! I'm merging this since overall folks seem to approve of it.

erichoracek

comment created time in 10 days

pull request commentairbnb/swift

Add "No direct standard out" rule

Thank you Eric! I'm merging this since overall folks seem to approve of it.

erichoracek

comment created time in 10 days

push eventairbnb/swift

Eric Horacek

commit sha 175c074a5bd57e72146876a014b12cd7be8c1003

Add "prefer immutable statics" rule (#120) * Add "prefer immutable statics" rule ## Summary **Prefer immutable or computed static variables over mutable ones whenever possible.** Use stored `static let` properties or computed `static var` properties over stored `static var`s properties whenever possible, as stored `static var` properties are global mutable state. ### Why? Global mutable state increases complexity and makes it harder to reason about the behavior of applications. It should be avoided when possible. ```swift // WRONG enum Fonts { static var title = UIFont(…) } // RIGHT enum Fonts { static let title = UIFont(…) } ``` ```swift // WRONG struct FeatureState { var count = 1 static var initial = FeatureState() } // Right struct FeatureState { var count = 1 static var initial: FeatureState { // Vend static properties that are cheap to compute FeatureState() } } ``` * Update state example * Improve formatting, fix wording

view details

push time in 10 days

delete branch airbnb/swift

delete branch : eh--prefer-immutable-statics

delete time in 10 days