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

Jacob Schwartz: F-yeah Swift

Realm
September 24, 2015
13k

Jacob Schwartz: F-yeah Swift

Realm

September 24, 2015
Tweet

Transcript

  1. L O O K I N G B A C

    K O N A Y E A R O F U S I N G S W I F T: L E S S O N S L E A R N E D … ( S O R T O F ) @ I S O I P H O N E
  2. W H Y A M I H E R E

    ? • iOS dev since 2008 (ObjC/C++) • Using Swift exclusively for ~11 months (@glintinc) • I enjoy talks about what worked / what didn’t • I enjoy hearing personal experiences from devs, so I’m here to share some…
  3. @ I S O I P H O N E

    L O O K I N G B A C K O N A Y E A R O F U S I N G S W I F T: L E S S O N S L E A R N E D … ( S O R T O F )
  4. N O T E N O U G H T

    I M E F O R T H AT • Swift is a big language • I have < 10 minutes • I want to call out 4 things that greatly affect how I write code in Swift (vs ObjC)
  5. N O T E N O U G H T

    I M E F O R T H AT • These things made Swift productive for me • So— how do I feel after 11 months of working with the language…
  6. W H AT S T H E R E T

    O B E E X C I T E D A B O U T ?
  7. in C++ more const correctness = more effort class Puter

    { void compute(obj *ptr); void compute(const Obj *ptr); void compute(Obj * const ptr); void compute(const Obj * const ptr); void compute(const Obj * const ptr) const; }; Swift var dateString = formatter.stringFromDate(date) let dateString = formatter.stringFromDate(date) vs
  8. A particularly messy but illustrative property var responseRate: Double? {

    didSet { let percent = min(100, max(0, Int((responseRate ?? 0) * 100))) let baseString = NSLocalizedString("$0 Response Rate", comment: "PulseTabResponseRate") let percentString = "\(percent)%" middleLabel.text = baseString.stringByReplacingOccurrencesOfString("$0", withString: percentString) } }
  9. S E R I O U S M O M

    E N T : ( • Not everything about Swift is great • There have been challenges
  10. S E R I O U S M O M

    E N T : ( • Supporting iOS < 8 effectively impossible • Compilation slow • Strange compiler errors • Tools break often
  11. S E R I O U S M O M

    E N T : ( • Supporting iOS < 8 effectively impossible • Compilation slow • Strange compiler errors • Tools break often These are known issues. They don’t change the point of this talk
  12. S U M M A RY ( 1 / 2

    ) • Strong typing • Immutability • Properties • Community • Dense • Expressive • Fun
  13. S U M M A RY ( 2 / 2

    ) • Dense • Expressive • Fun • Productive
  14. For me, Swift has been productive by being dense, expressive,

    and fun (even though the tools suck some times) I N C O N C L U S I O N