We have seen a few things so far that are surprising with Swift. We also looked at some aspects of class implementations in Swift 4. Now that Swift 5 has been released, with a stable ABI, let’s see how things compare to Objective-C, digging into internal data structures like we did in Objective-C.
Objective-C classes are defined elegantly, using C data structures that are relatively easy to follow and understand. A class definition is associated with a metaclass (to allow the class to be treated as a data object), as well as a group of functions treated as either class or member methods. Classes are associated with supported protocols and superclasses as well. We haven’t specifically looked at protocol support nor at how methods are dynamically located, or how errors are handled. We’ll look at all of these and start to filter conclusions through a security perspective.