The 2019 edition of dotSwift took place in Paris on the afternoon of January 28, at the Théâtre de Paris, in the 9th arrondissement, organized, as before, by the dotConferences team.
As the name suggests, the conference focuses heavily on the Swift language and the ways it can be leveraged to solve technological challenges and build great apps. This most recent edition featured 8 full talks and 5 lightning talks, and some working knowledge of Swift and experience working with Apple’s platform was necessary to fully appreciate their content. Here, we run through what was discussed on the day.
1. Just Enough Objective-C by Daniel Jalkut
There’s no such thing as a pure Swift app, as all of Apple’s platforms are built around Objective-C. Given the popularity of the Swift language, many young developers have elected to stick to it, and are therefore completely unfamiliar with Objective-C. The goal of this talk, therefore, was to focus on the elements of Objective-C that play a key part in the inner workings of any modern app.
Daniel Jalkut first explained how the underlying Objective-C runtime environment dispatches method calls, and the ways in which this system is different from the one available in “pure Swift” code.
He then went on to show how this knowledge can be leveraged effectively, for instance by setting up powerful breakpoints, whose trigger mechanisms rely on the Objective-C runtime.
2. From Problem to Solution by Soroush Khanlou
Properly dealing with complexity is a challenge that app developers face on a daily basis. In his talk, Soroush Khanlou took the example of how code that performs network calls quickly increases in complexity as concepts such as authentication or background execution are introduced. He then built on this setup to demonstrate how it can be efficiently managed.
Khanlou advised using composition as a way of keeping complexity at bay and emphasized the importance of testability, outlining actionable steps, as below:
- Find the similarities in the problem.
- Develop the right abstraction for those similarities.
- Build tools to make it convenient to use.
- Extract the complexity within the abstraction.
3. Scientific Swift by Jeff Biggus
Scientific computing—the writing and execution of scientific computations—is not a topic that gets discussed often at mainstream tech conferences. Fortunately, this talk from Jeff Biggus was a great opportunity to bring yourself up to speed and realize how Swift is a particularly relevant tool for the topic.
Because Swift allows developers to use Unicode symbols within code identifiers (such as variable and function names), it is possible to use standard math symbols, such as ∂, ∑, or ∈, within your code.
In his talk, Biggus demonstrated how this makes it possible to transcript equations into code, using a syntax that stays very close to the original material and therefore ensuring it will be understandable to fellow scientists.
4. Wh@t Is Th@t (Attributes for Swift code) by Mark Dalrymple
Developers are familiar with the use of Swift attributes, such as “@discardableResult,” but few are aware of how they are actually implemented.
Throughout his talk, Mark Dalrymple used the example of Swift Attributes as a gateway to introduce the audience to some inner concepts and workings of the Swift compiler.
For Swift developers, this talk was the perfect opportunity to get a better grasp of the abstract syntax tree, the data structure that the compiler uses to represent and work with Swift code.
Given that the Swift compiler is open-sourced on GitHub, Dalrymple was also able to show how it’s possible to have a peek at the implementation of any Swift attribute.
5. High-Performance Systems in Swift by Johannes Weiss
Johannes Weiss discussed some lessons learnt about how NOT to write slow Swift programs, thanks to his experience in implementing SwiftNIO.
He focused on the misconceived idea that a struct will be inherently slower than a class, because its value semantics forces the former to be copied whenever it is passed around, and went on to explain how this limitation can easily be overcome through the use of a copy-on-write mechanism.
This allows a struct to retain its value semantics, but will enforce a lazy approach to copying operations by deferring them to the moment when they become absolutely necessary, that is when data is being mutated. This provides the developer with the advantages of both abstraction and performance.
6. Make Table Views Great Again by Lea Marolt Sonnenschein
UITableView is one of the oldest APIs in the iOS SDK–it’s been there since the initial release, back in 2008! But while it is still a useful API, there are ways in which it is beginning to show its age.
That’s why Lea Marolt Sonnenschein had some tips for making this venerable API much easier to work with, as summarized below:
- Use protocol-oriented programing to remove the need for hardcoded reuseIdentifiers
- Get rid of repeated information through generics.
- Leverage enums to efficiently model the data you want to display.
7. Scripting with Swift by James Dempsey
Swift is most often used to develop apps for Apple’s platforms. Yet, it is also possible to use it as a scripting language, which is an appealing endeavor, because it gives the developer access to a very broad range of APIs that can be called with a familiar and convenient syntax.
However, this task comes with its own challenges, as dependency management, for one, is anything but trivial.
In his talk, James Dempsey gave examples of where it makes sense to use Swift as a scripting language, along with some pointers for how to overcome the challenges that it brings with it. These include the right command line to deal with the issue of environment variables, and the name of tools that make dependencies more manageable.
8. Network Protocols with Swift by Tom Doron
Standard network protocols, such as HTTP, are more than capable of suiting the needs of a large majority of apps. But there are some apps out there with requirements that are so specific that they must rely on custom network protocols.
Implementing such custom protocols can be a real challenge, but it is made easier by using SwiftNIO, a framework dedicated to the implementation of performance-focused client and server protocols.
Tom Doron leveraged SwiftNIO to show how it can be used to implement a protocol that will enable JSON remote procedure calls.
1. Avoiding the Kitchen Sink Database by Charles Parnot
If you’ve ever worked on an app that relies on a local database, you must have noticed that, as time passes, this database tends to become more and more cluttered with responsibilities, making it increasingly hard to maintain it. In this talk, Charles Parnot shared some architectural insights on how such a disastrous situation can be avoided.
2. The Underestimated Power of KeyPaths by Vincent Pradeilles
A KeyPath is a syntax introduced with Swift 4 that lets developers defer calls to the getter, or setter, of a property. But since their introduction, they have become famous for how little developers use them. Vincent Pradeilles took this opportunity to illustrate how easily they can be tweaked to work with many functions of the Swift Standard Library, creating a very clear and idiomatic syntax in the process.
3. CATransform3D: You Don’t Need to Know Them by Janina Kutyn
Wisely used, visual effects can be major assets to a user experience. In her lightning talk, Janina Kutyn explained the matrix math that backs many of the visual effects you’ll find in popular apps.
4. Marzipan—UIKit on macOS by Jan Kaltoun
Marzipan is the codename for Apple’s work-in-progress framework for running iOS apps on Macs. Even though Apple is yet to make it officially available to the public, Jan Kaltoun explained how curious—and courageous—developers can proceed if they want a preview of what their app would look like running on a Mac.
5. Extensions by Jason Akakpo
In 2019, apps are no longer just apps: many of them come bundled with several extensions that allow them to seamlessly integrate with Siri, iMessage, and other native capabilities. Jason Akakpo gave a brief overview of how those extensions work.
What we learnt from the event
At the end of day the day, attendees were left with a lot of new knowledge, including:
- The ways in which Swift can be used (as a scripting language and to implement scientific computations).
- How some simple tricks can make a real difference (by improving old APIs or boosting code performance).
- How low-level aspects of the language work (to implement attributes or custom network protocols).
- How some basic knowledge of good old Objective-C can be of use, even to a Swift developer.
- The steps that allow us to efficiently manage the growing complexity of a codebase.
What we liked
- The beautiful venue: dotSwift was held in a working theatre—not the usual setting for a tech conference!
- The high-quality talks, which didn’t shy away from addressing very technical topics.
- The exciting news that next year’s edition is scheduled to last a whole day, and be filled with even more content!
This article is part of Behind the Code, the media for developers, by developers. Discover more articles and videos by visiting Behind the Code!
Follow us on Twitter to stay tuned!
Illustrations by WTTJ