1

I am working on a CocoaPods iOS framework that will be later published and used via CocoaPods. I am in the middle of development. I have an Example project within, that points back to my framework via static path in the Podfile and which facilitates in the development.

Now every time I fix/change something in my framework, I need to clean the project and run Xcode to see my changes. Otherwise, changes don't take affect.

I am looking a way to automatically clean my project when I hit Run on Xcode.

My Xcode version is 11.1.

HAK
  • 2,023
  • 19
  • 26

1 Answers1

1

Add a run script in your build phases and do xcodebuild -sdk "${TARGET_SDK}" -xcconfig "${CONFIG_FILE_PATH}" -configuration Debug clean

A simple xcodebuild clean should do as well depending on your needs look at the Apple's documentation

Pancho
  • 4,099
  • 1
  • 21
  • 32
  • A little bit of details would help along. What have you done and what was the problem? It worked here for me. – Pancho Dec 03 '19 at 11:14
  • Do you actually want to rebuild your CocoaPods or clean your Xcode project? – Pancho Dec 03 '19 at 11:17
  • When I press Cmd+Opt+K, Xcode cleans my project along with the CocoaPods targets as well. So that when I run, the project, CocoaPods framework is rebuilt. I want that thing to be achieved via Xcode run script. – HAK Dec 03 '19 at 12:16
  • Though I am able to achieve it via my custom script but in that case, I have to use my own custom script to run the app. Not the Xcode's run button. – HAK Dec 03 '19 at 12:17
  • You can run your project via xcode run button and your custom script will run as well. maybe you should add `pod install` after your clean your project – Pancho Dec 03 '19 at 14:56
  • You are right, I need `pod install`. But when I press cmd+opt+k to clean the project, pod libraries are built and I don't need to run `pod install` in that case. So I was looking a script base alternative for cmd+opt+k command. – HAK Dec 04 '19 at 04:38