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.
Topic: Programming Languages SubTopic: Swift Tags:
May ’22
Reply to Loading content from `.reality` file resulting in crash
As per @adarshpavani suggestion, I created a generic project to replicate this issue. Upon further inspection, I narrowed this behaviour down to situations when the scene is loaded from a background thread. I've submitted this feedback via Feedback Assistant and the Feedback ID is FB11183405.
Topic: Graphics & Games SubTopic: RealityKit Tags:
Replies
Boosts
Views
Activity
Aug ’22
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.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’22
Reply to Subclassing `MKMapItem` resulting in Fatal error
One approach suggested is wrapping MKMapItem instead of subclassing it. This is one alternative solution for part 2. from the original question, but the root cause behind the fatal error is sidestepped with this approach.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Apr ’22