Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to thoroughly rename a Universal Framework in Xcode?

I'm building a Framework, originally named Iris.

When trying to publish it as a Cocoapod I found out that there is an "Iris" framework already.

And while they have completely diferent purposes and authors, I cannot publish it as a pod with this name. So I did the unthinkable!

I tried renaming the whole thing to IrisKit.

My Xcode project, now named IrisKit, has 6 targets:

3 Framework targets

- IrisKit iOS
- IrisKit tvOS
- IrisKit macOS

3 Example Projects

- IrisKit Example iOS
- IrisKit Example tvOS
- IrisKit Example macOS

Unfortunatly, my Example projects won't let me import IrisKit with an error that states:

warning: file 'FeedTableViewController.swift' is part of module 'IrisKit'; ignoring import

What's a developer to do?

like image 553
nmdias Avatar asked May 15 '16 19:05

nmdias


1 Answers

Backup your project, or if you're under source control, create a new branch and work from there.

Here are the steps taken:

1. Renamed the Project in the project's "Identity and Type"

enter image description here

2. Renamed Schemes to IrisKit

enter image description here

3. Renamed Folders and Groups to IrisKit

enter image description here

4. Updated the info.plist references under Build-Settings > Packaging

enter image description here

5. Updated the Bundle Identifiers under Build-Settings > Packaging

enter image description here

6. Updated the Public Header to IrisKit.h

enter image description here

7. Updated Example projects import to IrisKit

enter image description here

8. Updated Dependency Management:

   - Swift Package Manager
   - Cocoapods specs

9. Finally, and good lord this is important:

Targets that are not meant to be built with the framework, must have a different product name than the Framework they use. e.g. An Example Project that showcases the framework

It may sound obvious, but can be easy to miss when mass renaming things

-

The framework with the same name for multiple build targets:

enter image description here

enter image description here

enter image description here

And the Example target. Notice that the name is different from the framework targets.

enter image description here

Took me a while to figure this one out. Hope it helps.

like image 162
nmdias Avatar answered Sep 22 '22 23:09

nmdias