You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when implementing delegates in Swift for classes that interact with Objective-C, delegates often need to inherit from NSObject and be marked with @objc. This requirement adds boilerplate and limits flexibility, especially when designing Swift-first APIs. This proposal suggests allowing delegates to conform to AnyObject instead, providing more flexibility and aligning with Swift conventions.
Details:
Current Limitation: Delegates must inherit from NSObject and be annotated with @objc to work with Objective-C interoperability.
Proposed Solution: Extend interoperability to delegates conforming to AnyObject, maintaining compatibility with Objective-C while embracing Swift conventions.
Benefits:
Simplifies API design by reducing boilerplate (@objc and NSObject inheritance).
Enables better alignment with Swift's type system and safety features.
Allow clients not expose strings paths inside the binary (that happens if you have to inherit from NSObject)
The text was updated successfully, but these errors were encountered:
purchases-ios/Sources/Purchasing/Purchases/PurchasesDelegate.swift
Line 24 in dbcfe0c
Currently, when implementing delegates in Swift for classes that interact with Objective-C, delegates often need to inherit from NSObject and be marked with @objc. This requirement adds boilerplate and limits flexibility, especially when designing Swift-first APIs. This proposal suggests allowing delegates to conform to AnyObject instead, providing more flexibility and aligning with Swift conventions.
Details:
Benefits:
Simplifies API design by reducing boilerplate (@objc and NSObject inheritance).
Enables better alignment with Swift's type system and safety features.
Allow clients not expose strings paths inside the binary (that happens if you have to inherit from NSObject)
The text was updated successfully, but these errors were encountered: