Skip to content

Commit

Permalink
add binaryTarget of xcframework
Browse files Browse the repository at this point in the history
  • Loading branch information
lexrus committed Sep 20, 2020
1 parent 9418421 commit 3de24d5
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 16 deletions.
4 changes: 2 additions & 2 deletions LTMorphingLabel.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "LTMorphingLabel"
s.version = "0.9.0"
s.version = "0.9.1"
s.summary = "Graceful morphing effects for UILabel written in Swift."
s.description = <<-DESC
A morphing UILabel subclass written in Swift.
Expand All @@ -21,7 +21,7 @@ Pod::Spec.new do |s|
s.social_media_url = "https://twitter.com/lexrus"
s.ios.deployment_target = "9.0"
s.tvos.deployment_target = "9.0"
s.swift_versions = ['5.2']
s.swift_versions = ['5.3']
s.source = {
:git => "https://github.com/lexrus/LTMorphingLabel.git",
:tag => s.version
Expand Down
10 changes: 5 additions & 5 deletions LTMorphingLabelDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
/* Begin PBXFileReference section */
D723B2CB196A3FD100B1BBE8 /* Sparkle.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Sparkle.png; sourceTree = "<group>"; };
D72CE5F420863C9D005BBDEF /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
D73DFD1A1F4DB5CC00F84122 /* LTMorphingLabel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LTMorphingLabel.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D73DFD1A1F4DB5CC00F84122 /* MorphingLabel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MorphingLabel.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D73DFD1B1F4DB5CC00F84122 /* tvOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "tvOS-Info.plist"; path = "/Users/lex/git/LTMorphingLabel/LTMorphingLabel/tvOS-Info.plist"; sourceTree = "<absolute>"; };
D73DFD201F5056A700F84122 /* LTMorphingLabelUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LTMorphingLabelUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
D73DFD221F5056A700F84122 /* LTMorphingLabelUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LTMorphingLabelUITests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -257,7 +257,7 @@
D74AD96E195171E7009A2ACD /* Morphing.app */,
D7D4B01F1A5E87D50087F83D /* MorphingLabel.framework */,
D7934DC61A63AF1100AE04CE /* LTMorphingLabelTests.xctest */,
D73DFD1A1F4DB5CC00F84122 /* LTMorphingLabel.framework */,
D73DFD1A1F4DB5CC00F84122 /* MorphingLabel.framework */,
D73DFD201F5056A700F84122 /* LTMorphingLabelUITests.xctest */,
);
name = Products;
Expand Down Expand Up @@ -386,7 +386,7 @@
);
name = LTMorphingLabel_tvOS;
productName = LTMorphingLabel;
productReference = D73DFD1A1F4DB5CC00F84122 /* LTMorphingLabel.framework */;
productReference = D73DFD1A1F4DB5CC00F84122 /* MorphingLabel.framework */;
productType = "com.apple.product-type.framework";
};
D73DFD1F1F5056A700F84122 /* LTMorphingLabelUITests */ = {
Expand Down Expand Up @@ -725,7 +725,7 @@
);
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = sh.lex.LTMorphingLabel;
PRODUCT_NAME = LTMorphingLabel;
PRODUCT_NAME = MorphingLabel;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2,3";
Expand Down Expand Up @@ -755,7 +755,7 @@
);
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = sh.lex.LTMorphingLabel;
PRODUCT_NAME = LTMorphingLabel;
PRODUCT_NAME = MorphingLabel;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2,3";
Expand Down
Binary file not shown.
10 changes: 8 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ import PackageDescription
let package = Package(
name: "LTMorphingLabel",
products: [
.library(name: "LTMorphingLabel", targets: ["LTMorphingLabel"])
.library(name: "LTMorphingLabel", targets: ["LTMorphingLabel"]),
.library(name: "LTMorphingLabelXCFramework", targets: ["LTMorphingLabelXCFramework"])
],
targets: [
.target(
name: "LTMorphingLabel",
path: "LTMorphingLabel",
exclude: ["LTMorphingLabel/SwiftUI/MorphingText.swift"]
)
),
.target(
name: "LTMorphingLabelXCFramework",
url: "https://github.com/lexrus/LTMorphingLabel/releases/download/0.9.1/LTMorphingLabel.framework.zip",
checksum: "c40d71025beb8be5855cf78c0a4ab8d16762d183adce2b5196cff3d3a3c65c2e"
)
]
)
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,35 @@ public var body: some View {

## Installation

### [Swift Package Manager](https://swift.org/package-manager/)

1. File > Swift Packages > Add Package Dependency
2. Copy & paste `https://github.com/lexrus/LTMorphingLabel` then follow the instruction
3. Select the source framework or the xcframework

### [XCFramework](https://developer.apple.com/videos/play/wwdc2019/416/)

XCFramework is a new option intruduced in Xcode 11.
Download the pre-compiled LTMorphingLabel.xcframework.zip from the [Releases](https://github.com/lexrus/LTMorphingLabel/releases) page.
You may also use the binaryTarget of Swift Package Manager with Xcode 12.

### [Carthage](https://github.com/Carthage/Carthage)

1. Add this line to your Cartfile: `github "lexrus/LTMorphingLabel"`
2. Read the [official instruction](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application)

### [CocoaPods](http://cocoapods.org)

1. Install the latest release of CocoaPods: `gem install cocoapods`
2. Add this line to your Podfile: `pod 'LTMorphingLabel'`
3. Install the pod: `pod install`

### [Accio](https://github.com/JamitLabs/Accio)

1. Add the following to your Package.swift:

```swift
.package(url: "https://github.com/lexrus/LTMorphingLabel.git", .upToNextMajor(from: "0.9.0")),
.package(url: "https://github.com/lexrus/LTMorphingLabel.git", .upToNextMajor(from: "0.9.1")),
```

2. Next, add `LTMorphingLabel` to your App targets dependencies like so:
Expand All @@ -85,12 +103,6 @@ public var body: some View {

3. Then run `accio update`.

### [CocoaPods](http://cocoapods.org)

1. Install the latest release of CocoaPods: `gem install cocoapods`
2. Add this line to your Podfile: `pod 'LTMorphingLabel'`
3. Install the pod: `pod install`

## Usage

1. Change the class of a label from UILabel to LTMorphingLabel;
Expand All @@ -116,6 +128,7 @@ And finally, [an Android port](https://github.com/hanks-zyh/HTextView).
## Third Party Bindings

### React Native

You may now use this library with [React Native](https://github.com/facebook/react-native) via the module [here](https://github.com/prscX/react-native-morphing-text)

## License
Expand Down
50 changes: 50 additions & 0 deletions build_xcframework.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

PROJECT_FILE="LTMorphingLabelDemo.xcodeproj"
SCHEME="LTMorphingLabel"
BUILD_FOLDER="Build/LTMorphingLabel"

mkdir -p Build

# iOS Simulator
xcodebuild archive -project "$PROJECT_FILE" -scheme "$SCHEME" -configuration Release \
-archivePath "$BUILD_FOLDER/Simulator" \
-sdk iphonesimulator \
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES

# iOS
xcodebuild archive -project "$PROJECT_FILE" -scheme "$SCHEME" -configuration Release \
-archivePath "$BUILD_FOLDER/iOS" \
-sdk iphoneos \
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES

# tvOS
xcodebuild archive -project "$PROJECT_FILE" -scheme "$SCHEME" -configuration Release \
-archivePath "$BUILD_FOLDER/tvOS" \
-sdk appletvos \
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES

# tvOS Simulator
xcodebuild archive -project "$PROJECT_FILE" -scheme "$SCHEME" -configuration Release \
-archivePath "$BUILD_FOLDER/tvOSSimulator" \
-sdk appletvsimulator \
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES

# XCFramework
xcodebuild -create-xcframework \
-framework Build/LTMorphingLabel/iOS.xcarchive/Products/Library/Frameworks/MorphingLabel.framework \
-framework Build/LTMorphingLabel/tvOS.xcarchive/Products/Library/Frameworks/MorphingLabel.framework \
-framework Build/LTMorphingLabel/Simulator.xcarchive/Products/Library/Frameworks/MorphingLabel.framework \
-framework Build/LTMorphingLabel/tvOSSimulator.xcarchive/Products/Library/Frameworks/MorphingLabel.framework \
-output Build/LTMorphinLabel.xcframework

cd Build

# Compress
zip -vry LTMorphingLabel.xcframework.zip LTMorphinLabel.xcframework/ -x "*.DS_Store"

# Checksum for Package.swift
swift package compute-checksum LTMorphingLabel.xcframework.zip | pbcopy

# Open in Finder
open ./

0 comments on commit 3de24d5

Please sign in to comment.