Slide 1

Slide 1 text

Porting Obj-C to Swift Justin Sheckler, Etsy

Slide 2

Slide 2 text

Should I port my code?

Slide 3

Slide 3 text

Maybe!

Slide 4

Slide 4 text

You’re still using Obj-C (for now, at least)

Slide 5

Slide 5 text

Read the Docs! http://bit.ly/objc2swift

Slide 6

Slide 6 text

Adding Swift to an Existing Project

Slide 7

Slide 7 text

Just add a new file and go

Slide 8

Slide 8 text

Your New Best Friend: The Bridging Header It imports Swift classes into Obj-C.

Slide 9

Slide 9 text

Point to custom Bridging Header in Build Settings

Slide 10

Slide 10 text

Where do I Start?

Slide 11

Slide 11 text

But, Can I Import Swift Back Into Obj-C? Yes! But it works totally differently. ಠ_ಠ

Slide 12

Slide 12 text

The Compatibility Header Your new second-best friend.

Slide 13

Slide 13 text

Let’s Demo! http://bit.ly/objc2swiftdemo

Slide 14

Slide 14 text

Gotchas! ● Be careful of custom Obj-C types in Swift arguments ● May need to cast primitive types to/from plain-C APIs ● Obj-C/Swift bridges may still be buggy

Slide 15

Slide 15 text

Questions? @jayKayEss http://bit.ly/objc2swift (Apple docs) http://bit.ly/objc2swiftdemo (My Demo)