Skip to content

Instantly share code, notes, and snippets.

@richardleandro1
Created August 25, 2022 17:20
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save richardleandro1/7b0aad8d1b8e0b5b63cb1a50651b1f3a to your computer and use it in GitHub Desktop.
In Terminal cd to the root folder of the Framework project
Archive for iOS
xcodebuild archive \
-scheme FrameworkName \
-configuration Release \
-destination 'generic/platform=iOS' \
-archivePath './build/FrameworkName.framework-iphoneos.xcarchive' \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
Archive for Simulator
xcodebuild archive \
-scheme FrameworkName \
-configuration Release \
-destination 'generic/platform=iOS Simulator' \
-archivePath './build/FrameworkName.framework-iphonesimulator.xcarchive' \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
Archive for macOS
xcodebuild archive \
-scheme FrameworkName \
-configuration Release \
-destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' \
-archivePath './build/FrameworkName.framework-catalyst.xcarchive' \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
Create Framework
xcodebuild -create-xcframework \
-framework './build/FrameworkName.framework-iphonesimulator.xcarchive/Products/Library/Frameworks/FrameworkName.framework' \
-framework './build/FrameworkName.framework-iphoneos.xcarchive/Products/Library/Frameworks/FrameworkName.framework' \
-framework './build/FrameworkName.framework-catalyst.xcarchive/Products/Library/Frameworks/FrameworkName.framework' \
-output './build/FrameworkName.xcframework'
All in one
xcodebuild archive \
-scheme FrameworkName \
-configuration Release \
-destination 'generic/platform=iOS' \
-archivePath './build/FrameworkName.framework-iphoneos.xcarchive' \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
xcodebuild archive \
-scheme FrameworkName \
-configuration Release \
-destination 'generic/platform=iOS Simulator' \
-archivePath './build/FrameworkName.framework-iphonesimulator.xcarchive' \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
xcodebuild archive \
-scheme FrameworkName \
-configuration Release \
-destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' \
-archivePath './build/FrameworkName.framework-catalyst.xcarchive' \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
xcodebuild -create-xcframework \
-framework './build/FrameworkName.framework-iphonesimulator.xcarchive/Products/Library/Frameworks/FrameworkName.framework' \
-framework './build/FrameworkName.framework-iphoneos.xcarchive/Products/Library/Frameworks/FrameworkName.framework' \
-framework './build/FrameworkName.framework-catalyst.xcarchive/Products/Library/Frameworks/FrameworkName.framework' \
-output './build/FrameworkName.xcframework'
Set up Package file in the Swift Package project
// swift-tools-version: 5.6
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "FrameworkName",
platforms: [
.macOS(.v12), .iOS(.v15)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "FrameworkName",
targets: ["FrameworkName"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.binaryTarget(
name: "FrameworkName",
path: "./Sources/FrameworkName.xcframework")
]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment