Upgrade to Pro — share decks privately, control downloads, hide ads and more …

10 lessons we can learn from the 36,303 (and counting) Swift commits

10 lessons we can learn from the 36,303 (and counting) Swift commits

Presented at Devoxx 2016

Simone Civetta

April 21, 2016
Tweet

More Decks by Simone Civetta

Other Decks in Programming

Transcript

  1. 10 lessons we can learn from the 36,303 (and counting)

    Swift commits (And it's not a clickbait)
  2. Template %{ integerBinaryOps = [ (x[:-1], x[-1], x[:-1].capitalize(), 'a result')

    for x in 'add+ subtract- multiply* divide/'.split() ] + [ ('remainder', '%', 'Divide', 'the remainder') ] }% Usage public protocol _IntegerArithmeticType { % for name,_,Action,result in integerBinaryOps: /// ${Action} `lhs` and `rhs`, returning ${result} and a `Bool` that is /// true iff the operation caused an arithmetic overflow. static func ${name}WithOverflow(lhs: Self, _ rhs: Self) -> (Self, overflow: Bool) % end }
  3. /// Insert `newElement` at index `i`. /// /// Invalidates all

    indices with respect to `self`. /// /// - Complexity: O(`self.count`). public mutating func insert(newElement: Character, atIndex i: Index) { withMutableCharacters { (inout v: CharacterView) in v.insert(newElement, atIndex: i) } }
  4. Sources → Swift Weekly Brief by Jesse Squires → Swift

    Evolution Mailing List → github.com/apple