iOS XCFrameWork

Mario tsai
May 31, 2022

--

做第一個自己的framework

來自 https://www.youtube.com/watch?v=TCnhvHUcjrY

可以當作做一個自己的第三方資料庫使用。

開一個project 例如: CoolUI

然後打包後,放到專案裡面,

** ARCHIVE SUCCEEDED **

import CoolUI 後就可以使用裡面方法。

  1. Create framework

2. Add needed classes

3. Build Settings / Build Libraries for Distribution set YES

4. Build Settings / Skip Install set NO

5. Open termnial

6. cd and drag the folder with project

7. run three scripts in turn, which are located at the bottom (!) Don’t forget replace “PROJECTNAME_HERE” & “”FRAMEWORK_NAME” on your project name.

xcodebuild archive -scheme PROJECTNAME_HERE -destination=”iOS” -archivePath /tmp/xcf/ios.xcarchive -derivedDataPath /tmp/iphoneos -sdk iphoneos SKIP_INSTALL=NO

xcodebuild archive -scheme PROJECTNAME_HERE -destination=”iOS Simulator” -archivePath /tmp/xcf/iossimulator.xcarchive -derivedDataPath /tmp/iphoneos -sdk iphonesimulator SKIP_INSTALL=NO

xcodebuild -create-xcframework -framework /tmp/xcf/ios.xcarchive/Products/Library/Frameworks/PROJECTNAME_HERE.framework -framework /tmp/xcf/iossimulator.xcarchive/Products/Library/Frameworks/PROJECTNAME_HERE.framework -output FRAMEWORK_NAME.xcframework

--

--

Mario tsai
Mario tsai

Written by Mario tsai

Major in physical education. Football referee. And high interest in looking the world through the numbers.