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

Swifty Code: The Real World

Swifty Code: The Real World

Keynote of the lecture given at iOS TLV Meetup on August 3 2016 by Aviel Gross

Twitter: @avielgr

Aviel Gross

August 03, 2016
Tweet

More Decks by Aviel Gross

Other Decks in Programming

Transcript

  1. SWIFTY SWIFTIFICATIONS FOR SWIFT SWIFTTIBUTES *Texts in this keynote where

    written in some fonts that are not San-Francisco, please accept my sincere apology.
  2. OO IS OLD! PROTOCOL ORIENTED IS GOLD! USE STRUCTS NOT

    CLASSES! IT’S NOT FUNCTIONAL ENOUGH! I HEARD APPLE HAS THAT NEW SWIFT LANG…WHATS ALL THAT ABOUT?
  3. MAINLY LOGIC OR MODEL? CLASS Logic Model BIG/NOT- SELF CHANGES?

    Yes CLASS No STRUCT MIGHT WORK REFERENC ING A CLASS? Yes CLASS No
  4. Swift ❤ enums - Holds values (even named!) - $

    Can implement Protocols - Very light! (both on syntax and system)
  5. Use Guard - Verify condition/unwrap needed optional - Early failure

    - empty/zero/default result Don’t Use Guard - ‘else’ has logic - Entire func is a tiny if-else
  6. - associativity & precedence - val X val X val

    - X= version - Accepts optionals? - Returns optional? - $ test