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

How Do I Even Swift?

JP Simard
September 25, 2014

How Do I Even Swift?

Much has been said about the features of Swift, how it works and how to use it. But in this presentation, we discuss what's been left unsaid:

* How do I even get started?
* How do I even know when to use it?
* How do I even manage dependencies?
* How do I even interact with Cocoa API's?
* How do I even interact with C code?
* How do I even interact with C++ code?
* How do I even do horrible things with it?
* How do I even call private functions?
* How do I even document it?

Source: https://github.com/jpsim/talks

JP Simard

September 25, 2014
Tweet

More Decks by JP Simard

Other Decks in Programming

Transcript

  1. // Using Realm Objects let company = Company() company.name =

    "Realm" // etc... // Transactions defaultRealm().transaction { realm.add(company) } // Querying objects let companies = objects(Company) companies[0]?.name // => Realm (generics) let ftJohns = objects(Employee) .filter(.fullTime == true || .name == "John")
  2. This talk is not about... ▸ Optionals ▸ Type safety

    & inference ▸ Enums ▸ Tuples ▸ Generics ▸ Closures
  3. WHEN TO USE SWIFT ▸ New apps ▸ Personal projects

    ▸ Scripts ▸ Bribe your boss to use it in production* * I am not liable !
  4. SWIFT IN PRODUCTION ▸ Large companies are doing it (twitter

    & Facebook) ▸ Contractors are doing it ▸ I'm doing it ▸ But be careful if you do it
  5. PORTING UIKIT CODE IS VERY STRAIGHTFORWARD func tableView(tableView: UITableView, numberOfRowsInSection

    section: Int) -> Int { return items.count } func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { var cell = tableView.dequeueReusableCellWithIdentifier("cell") as UITableViewCell cell.textLabel.text = items[indexPath.row] return cell }
  6. Though it's possible to replace [square brackets] with (parentheses) and

    call it Swift, it's by no means where it ends
  7. LINKS () ▸ Official Swift blog ▸ The Swift Programming

    Language Book ▸ WWDC Videos ▸ WWDC Sample Code ▸ Xcode 6 (and other resources) Free Apple Developer Account Required
  8. LINKS (!) ▸ This talk: github.com/jpsim/talks ▸ Other Swift talks:

    realm.io/news ▸ Airspeed Velocity: airspeedvelocity.net ▸ ObjC/Swift doc generator: github.com/realm/jazzy ▸ Russ Bishop: Horrible things in Swift ▸ Mike Ash's Swift/C Playground from NSSpain: Zip Download