Post

Replies

Boosts

Views

Activity

Reply to Subclassing `MKMapItem` resulting in Fatal error
I'll try and summaries the content from the links shared by Scott in the above response to make the information more accessible. The below diagram represents the general overview for the initialisation process in Swift. The root cause for the observed behaviour appears to be related to subclassing an Objective-C base class in Swift where the implementation of the base class initialisation process appears to trigger an unaccounted scenario resulting from the differences in the initialisation rules for Objective-C and Swift. The difference in initialisation rules specific to this post are- Ojbective-C allowing a convenience initialiser to be invoked from a base class Swift classes not automatically inheriting the base class initialisers The second point is relevant when an Objective-C class looks for an initialiser in the base class. I'm uncertain behind the exact details of this, but from what I can gather, Objective-C subclasses automatically inherit all the initialisers from the base class, and hence the initialiser from the subclass is used when a convenience initialiser from the base class invokes a designated initialiser.
May ’22