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
Please consider submitting the following information (if relevant):
Library setup method: CocoaPods
Version of the library: 23.0.0
Xcode version: 15.4
OS version iOS 17.6.1
When embedding the project into my Objective-C project with latest Xcode 15.4 while following the manual, I get a ton of Xcode errors.
I have related them to 2 root causes and provide solutions below:
CosmosSettingsObjCBridge.swift:38:72 Cannot find type 'CosmosView' in scope
CosmosSettingsObjCBridge.swift:39:26 Cannot find 'StarFillMode' in scope
CosmosSettingsObjCBridge.swift:50:47 Cannot find type 'CosmosView' in scope
etc.
Solution
Add an import to the top of this file:
import Cosmos
Issue 2 - No known class method for selector 'YYY'
Wherever I use CosmosSettingsObjCBridge in my ViewControllers, I get errors like:
ViewController.m:53:31 No known class method for selector 'setFillMode:inCosmosView:'
It appears that the functions in the Bridge file are no longer accessible since Xcode 10 / Swift 4.
Replace @objc in the class declaration of CosmosSettingsObjCBridge by @objcMembers once, so all methods within the class will be exposed to Objective-C:
According to this article, is available since iOS 8.0.
Option 2 is simple and elegant and resolves all warnings.
The text was updated successfully, but these errors were encountered:
funnel20
changed the title
The Objective-C bridge and documentation are outdated since Xcode 10 / Swift 4
The Objective-C bridge is outdated since Xcode 10 / Swift 4
Sep 3, 2024
funnel20
changed the title
The Objective-C bridge is outdated since Xcode 10 / Swift 4
The Objective-C bridge is outdated since Xcode 10 / Swift 4 and results in Xcode errors
Sep 3, 2024
funnel20
added a commit
to funnel20/Cosmos
that referenced
this issue
Sep 3, 2024
1) Resolved "Cannot find type 'XXX' in scope" by adding `import Cosmos`
2) Resolved "No known class method for selector 'YYY'" by replacing `@objc` by `@objcMembers` so all methods within the class will be exposed to Objective-C.
Please consider submitting the following information (if relevant):
When embedding the project into my Objective-C project with latest Xcode 15.4 while following the manual, I get a ton of Xcode errors.
I have related them to 2 root causes and provide solutions below:
Issue 1 - Cannot find type 'XXX' in scope
The bridge file errors:
Solution
Add an
import
to the top of this file:Issue 2 - No known class method for selector 'YYY'
Wherever I use
CosmosSettingsObjCBridge
in my ViewControllers, I get errors like:It appears that the functions in the Bridge file are no longer accessible since Xcode 10 / Swift 4.
Solution
This can be resolved in 2 ways:
@objc
to all of function declarations, e.g.:@objc
in the class declaration ofCosmosSettingsObjCBridge
by@objcMembers
once, so all methods within the class will be exposed to Objective-C:According to this article, is available since iOS 8.0.
Option 2 is simple and elegant and resolves all warnings.
The text was updated successfully, but these errors were encountered: