360iDev 2015 Conference Highlights
- The State of Independent iOS Developers
- Keynote: Still Here – Josh Michaels
- What’s In It For Us After the Indiepocalipse – Marin Todorov
- Succeeding Slowly: A Practical Guide To Going Indie – Charles Perry
- Swift and Functional Programming
- Switching Your Brain to Swift – Greg Heo
- Bringing Swift into your Objective-C Projects – René Cacheaux
- Bridging the Gap: Functional Programming in Objective C & Swift – Chris Woodward
- Auto Layout and Adaptive Layout Talks
- Universal Layout Workshop – Sam Davies
- Solving Auto Layout Problems – Jack Cox
- Mastering Auto Layout – Justin Williams
- Fun & Games
- Stump Jr 360: Not Dead Yet – Hosted by Tom Harrington
- Game Dev Jam – hosted by Tom Ortega
- Other Interesting Talks
- Apple Pay What Happens When You Tap – Stephan Huda
- Localization Explained – Ellen Shapiro
- Super Computing for iOS and Macs With Metal – Jeff Biggus
- Where to Go From Here?
Swift and Functional Programming
Switching Your Brain to Swift – Greg Heo
raywenderlich.com team member Greg Heo presented one of the most popular talks to a standing-room only crowd. Was it about striking it rich on the app store, or how to run a mobile iOS consulting firm from a beach in Bora Bora? Nope – it was about making the switch to developing in Swift and covered the differences between Swift and Objective-C.
Greg started the talk by polling the audience and found the vast majority had not written more than one hundred lines of Swift code. Drawing on analogies from Objective-C and C++, Greg attempted to lift the veil on Swift. He patiently explained the aspects of types and type safety by exploring how Optional types play an important role, and used the analogy of unwrapping or unboxing to reveal a puppy. The point, he says, is an Optional is more like the box than the puppy, which the box may or may not contain.
He went on to demonstrate how Swift and Objective-C can work together and demonstrated some of the ways that Swift works with Objective-C. He also covered some of the newer features of Objective-C that work with Swift. The talk helped clarify where the limits of Objective-C lie.
Bringing Swift into your Objective-C Projects – René Cacheaux
raywenderlich.com team member Rene Cacheaux’s talk was based on the experiences of his development team as they transitioned a large project from Objective-C to Swift. He began by stating he doesn’t dislike Objective-C, but because Apple went all in he’s since adopted the language. Swift is more concise and makes for safer, less crash-prone projects.
Using the Lord of the Rings as a metaphor, he tells of his fellowship’s journey. The poor framework support was the Mines of Moria, the project scheme bugs the Black Gates of Mordor. Gollum was the enterprise coding troubles that chased them on their journey and shipping an all-Swift app was analogous to destroying the Ring at Mount Doom.
The benefits of Swift are found in working with one file, without the need for .h or .m files or extensions. The downsides are that Swift doesn’t support macros and there was initial incompatibility with third-party libraries. The massive changes between Swift 1.0 and 1.2 posed many challenges, as did the limited ability to port Swift elements back to Objective-C.
Réné said his team decided to approach the project in a vertical fashion:
They began by converting one view controller, then moved downwards through child classes, then through persistence, networking and other utilities. Once the first vertical slice was converted, they moved on the the next vertical slice. Eventually, his team arrived at a complete rewrite — and Sauron was defeated! :]
Bridging the Gap: Functional Programming in Objective C & Swift – Chris Woodward
Functional programming gained a lot of attention with the introduction of Swift, and was mentioned in some of the more popular sessions at WWDC 2015. In his talk, Chris Woodward noted that wrapping your head around functional programming while making the switch to Swift can be incredibly challenging for object-oriented developers.
Many apps consist of complex and tangled logic, with thousands and thousands of lines of code. Managing this requires a complex mental model resulting in code that’s hard to read, reason about, extend, fix and test. Chris contended that humans have a limited capacity to store things. By grouping things together, our own mental storage capacity can go up and reduce the human bottleneck. So how do you avoid complex code? Add structure, avoid extra dependencies and adopt a functional style.
Chris stated this state of coding nirvana could be reached through the use of short functions. He laid out a few functional rules stating that functions should not share mutable state or cause side effects. Chris also discussed filtering using predicates, map and reduce functions. The main takeaways of the talk was that code should be readable and a functional style could be used in any language that supports anonymous functions.
Auto Layout and Adaptive Layout Talks
Universal Layout Workshop – Sam Davies
Six hands-on workshops preceded the conference, covering debugging, prototyping, core motion, HealthKit and animations; the format is quite similar to that of the hands-on tutorials at RWDevCon.
One of the highlights was the Universal Layout workshop, covered by raywenderlich.com team member Sam Davies. Sam presented a three-and-a-half hour review of layout in iOS, size classes, Adaptive Layout and stack views.
He began with a quick refresher on Auto Layout, and offered some tips to clarify some idiosyncrasies of using Auto Layout in Interface Builder. For example, when Control-dragging to create constraints, the direction of the drag changes the contextual menu that pops up. Also, bullets that appear in the contextual menu indicate which constraints already exist. He also suggested updating the frames in Interface Builder so the design time frames satisfy the constraints.
The introduction of multitasking in iOS 9 lets multiple apps appear on the screen at the same time. Adaptive Layout and size classes, which once appeared arbitrary, are now extremely important in the multitasking paradigm. If you already use Auto Layout, you’re ahead of the multitasking game.
Sam suggested that you handle layout as follows:
- Build your base layout first (Any, Any).
- Choose the Size Class overrides for the other sizes.
- Uninstall the irrelevant constraints.
- Add new relevant constraints.
- Rinse & Repeat.
Rotation methods should be avoided in the future; a combination of Auto Layout and Adaptive Layout will handle device rotation, since it’s really the size of the view that’s changing. In the end you avoid the “angry” red errors and the “less angry” orange warnings.
New in iOS 9, stack views now simplify the process of creating layouts, and Sam gave a great overview and demo of how they work as well. After seeing Sam give this talk, I have to say Stack Views are my new favorite thing!