6

I converted my entire Objective-C framework to Swift. After building it, when I check the framework's Header files, it is still displaying the old Objective-c functions.
I deleted all the Objective-C files from the framework project. I have tried cleaning and building the project. But with no success.

1
  • 1
    Did you try deleting the DerivedData folder? Commented Oct 8, 2018 at 10:07

4 Answers 4

1

You deleted the Objective-C files from the Xcode project, but did you also remove them from the file system and any source control you might be using?

Also, your Build Settings in your Xcode project can be searching for library/header files even after you've removed them from explicit inclusion in the Project Navigator in Xcode.

Just make sure the search paths don't look for old Obj-C stuff. Be careful of recursive searches like MyXcodeProject/**. The ** will recursively search all subfolders and their subfolders for things to include.

Better to specify folders directly in the search paths if you can. If you know you don't need search paths, you can just clear them all.

enter image description here

...although, you may want to leave the default exclusions in place:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

0

Remember that you can't subclass a Swift class in Objective-C. Therefore, the class you migrate can't have any Objective-C subclasses.

Once you migrate a class to Swift, you must remove the corresponding .m file from the target before building to avoid a duplicate symbol error.

To make a Swift class available in Objective-C, make it a descendant of an Objective-C class.

Command-click a Swift class name to see its generated header.

Option-click a symbol to see implicit information about it, like its type, attributes, and documentation comments.

from: https://developer.apple.com/documentation/swift/migrating_your_objective-c_code_to_swift

Also, delete your DerivedData, do a clean build and restart the xCode.

Comments

0

How can you see "Header" files in Swift based framework even after removing Obj C files. Definitely there's the build issue. If build is proper, then you are not referring/using to the right framework (in the app) after building it. This is most common mistake that I observed with many developers.

Comments

0

Maybe this can help, try it on your framework's Target Build Settings:

  • Disable modules (Enable modules (C and Objective-C))

Disable modules

  • Make sure the Swift version is set (Swift Language Version)

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.