Skip to content

Commit

Permalink
make ios available via spm
Browse files Browse the repository at this point in the history
  • Loading branch information
albho committed Dec 21, 2024
1 parent e6ab3d2 commit 9ce1256
Show file tree
Hide file tree
Showing 22 changed files with 140 additions and 383 deletions.
16 changes: 2 additions & 14 deletions .github/workflows/ios-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install Cocoapods
run: gem install cocoapods

- name: Run Cocoapods
run: pod install --repo-update

- name: Build
run: xcrun xcodebuild build
-configuration Debug
-workspace PicoLLMCompletionDemo.xcworkspace
-project PicoLLMCompletionDemo.xcodeproj
-sdk iphoneos
-scheme PicoLLMCompletionDemo
-derivedDataPath ddp
Expand All @@ -51,16 +45,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install Cocoapods
run: gem install cocoapods

- name: Run Cocoapods
run: pod install --repo-update

- name: Build
run: xcrun xcodebuild build
-configuration Debug
-workspace PicoLLMChatDemo.xcworkspace
-project PicoLLMChatDemo.xcodeproj
-sdk iphoneos
-scheme PicoLLMChatDemo
-derivedDataPath ddp
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/ios-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Run Cocoapods
run: pod install --repo-update

- name: Inject AccessKey
run: sed -i '.bak' 's:{TESTING_ACCESS_KEY_HERE}:${{secrets.PV_VALID_ACCESS_KEY}}:'
PicoLLMAppTestUITests/BaseTest.swift
Expand All @@ -42,14 +39,14 @@ jobs:
- name: XCode Build
run: xcrun xcodebuild build-for-testing
-configuration Debug
-workspace PicoLLMAppTest.xcworkspace
-project PicoLLMAppTest.xcodeproj
-sdk iphoneos
-scheme PicoLLMAppTest
-derivedDataPath ddp
CODE_SIGNING_ALLOWED=NO

- name: Run Tests on Simulator
run: xcrun xcodebuild test
-workspace PicoLLMAppTest.xcworkspace
-project PicoLLMAppTest.xcodeproj
-scheme PicoLLMAppTest
-destination 'platform=iOS Simulator,name=iPhone 13,OS=16.4'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
__pycache__
*.bin
*.pllm
.build
Package.resolved
.swiftpm
34 changes: 34 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "picoLLM-iOS",
platforms: [
.iOS(.v13)
],
products: [
.library(
name: "PicoLLM",
targets: ["PicoLLM"]
)
],
targets: [
.binaryTarget(
name: "PvPicoLLM",
path: "lib/ios/PvPicoLLM.xcframework"
),
.target(
name: "PicoLLM",
dependencies: ["PvPicoLLM"],
path: ".",
exclude: [
"binding/ios/PicoLLMAppTest",
"demo"
],
sources: [
"binding/ios/PicoLLM.swift",
"binding/ios/PicoLLMDialog.swift",
"binding/ios/PicoLLMErrors.swift"
]
)
]
)
156 changes: 32 additions & 124 deletions binding/ios/PicoLLMAppTest/PicoLLMAppTest.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions binding/ios/PicoLLMAppTest/Podfile

This file was deleted.

16 changes: 0 additions & 16 deletions binding/ios/PicoLLMAppTest/Podfile.lock

This file was deleted.

2 changes: 2 additions & 0 deletions binding/ios/PicoLLMErrors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
// specific language governing permissions and limitations under the License.
//

import Foundation

public class PicoLLMError: LocalizedError {
private let message: String
private let messageStack: [String]
Expand Down
8 changes: 7 additions & 1 deletion binding/ios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ models. picoLLM Inference Engine is:

## Installation
<!-- markdown-link-check-disable -->
The picoLLM iOS binding is available via [CocoaPods](https://cocoapods.org/pods/picoLLM-iOS). To import it into your iOS project, add the following line to your Podfile:
The picoLLM iOS binding is available via [Swift Package Manager](https://www.swift.org/documentation/package-manager/) or [CocoaPods](https://cocoapods.org/pods/picoLLM-iOS).
<!-- markdown-link-check-enable -->

To import the package using SPM, open up your project's Package Dependencies in XCode and add:
```
https://github.com/Picovoice/picollm.git
```
To import it into your iOS project using CocoaPods, add the following line to your Podfile:

```ruby
pod 'picoLLM-iOS'
```
Expand Down
4 changes: 2 additions & 2 deletions binding/ios/picoLLM-iOS.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Pod::Spec.new do |s|
<<-DESC
picoLLM Inference Engine iOS SDK.
DESC
s.homepage = 'https://github.com/Picovoice/picollm/tree/master/binding/ios'
s.homepage = 'https://github.com/Picovoice/picollm/tree/main/binding/ios'
s.author = { 'Picovoice' => 'hello@picovoice.ai' }
s.source = { :git => "https://github.com/Picovoice/picollm.git", :tag => "picoLLM-iOS-v1.2.3" }
s.source = { :git => "https://github.com/Picovoice/picollm.git", :tag => s.version.to_s }
s.ios.deployment_target = '16.0'
s.swift_version = '5.0'
s.vendored_frameworks = 'lib/ios/PvPicoLLM.xcframework'
Expand Down
101 changes: 28 additions & 73 deletions demo/ios/Chat/PicoLLMChatDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objectVersion = 60;
objects = {

/* Begin PBXBuildFile section */
02A11949268D39A700A2AC99 /* PicoLLMChatDemoApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A11948268D39A700A2AC99 /* PicoLLMChatDemoApp.swift */; };
02A1194B268D39A700A2AC99 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A1194A268D39A700A2AC99 /* ContentView.swift */; };
02A1194D268D39AB00A2AC99 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 02A1194C268D39AB00A2AC99 /* Assets.xcassets */; };
02A1195F268D3FD600A2AC99 /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A1195E268D3FD600A2AC99 /* ViewModel.swift */; };
3D2B8D90C4122A3A0C8C682D /* libPods-PicoLLMChatDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7231C033B41A0972F723C1A6 /* libPods-PicoLLMChatDemo.a */; };
C789D24B2BEA8E5D005FDB10 /* LoadModelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C789D24A2BEA8E5D005FDB10 /* LoadModelView.swift */; };
C789D24D2BEA8EAE005FDB10 /* ChatView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C789D24C2BEA8EAE005FDB10 /* ChatView.swift */; };
C789D2512BEAD752005FDB10 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = C789D2502BEAD752005FDB10 /* Constants.swift */; };
E1E0137E2D16114E00DB0C2F /* PicoLLM in Frameworks */ = {isa = PBXBuildFile; productRef = E1E0137D2D16114E00DB0C2F /* PicoLLM */; };
E1E013842D162B3D00DB0C2F /* PicoLLM in Frameworks */ = {isa = PBXBuildFile; productRef = E1E013832D162B3D00DB0C2F /* PicoLLM */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -24,9 +25,6 @@
02A1194C268D39AB00A2AC99 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
02A11951268D39AB00A2AC99 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
02A1195E268D3FD600A2AC99 /* ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModel.swift; sourceTree = "<group>"; };
195F7C81D2A651BE1E18D367 /* Pods-PicoLLMChatDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PicoLLMChatDemo.debug.xcconfig"; path = "Target Support Files/Pods-PicoLLMChatDemo/Pods-PicoLLMChatDemo.debug.xcconfig"; sourceTree = "<group>"; };
7231C033B41A0972F723C1A6 /* libPods-PicoLLMChatDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-PicoLLMChatDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; };
B4721F6A98EC8D37F91281AB /* Pods-PicoLLMChatDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PicoLLMChatDemo.release.xcconfig"; path = "Target Support Files/Pods-PicoLLMChatDemo/Pods-PicoLLMChatDemo.release.xcconfig"; sourceTree = "<group>"; };
C789D24A2BEA8E5D005FDB10 /* LoadModelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadModelView.swift; sourceTree = "<group>"; };
C789D24C2BEA8EAE005FDB10 /* ChatView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatView.swift; sourceTree = "<group>"; };
C789D2502BEAD752005FDB10 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
Expand All @@ -37,7 +35,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3D2B8D90C4122A3A0C8C682D /* libPods-PicoLLMChatDemo.a in Frameworks */,
E1E0137E2D16114E00DB0C2F /* PicoLLM in Frameworks */,
E1E013842D162B3D00DB0C2F /* PicoLLM in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -49,8 +48,6 @@
children = (
02A11947268D39A700A2AC99 /* PicoLLMChatDemo */,
02A11946268D39A700A2AC99 /* Products */,
8DB92FF3DC81AB04D3FF7242 /* Pods */,
F770462E5CFAB5B7D2E94AD8 /* Frameworks */,
);
sourceTree = "<group>";
};
Expand All @@ -77,35 +74,16 @@
path = PicoLLMChatDemo;
sourceTree = "<group>";
};
8DB92FF3DC81AB04D3FF7242 /* Pods */ = {
isa = PBXGroup;
children = (
195F7C81D2A651BE1E18D367 /* Pods-PicoLLMChatDemo.debug.xcconfig */,
B4721F6A98EC8D37F91281AB /* Pods-PicoLLMChatDemo.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
F770462E5CFAB5B7D2E94AD8 /* Frameworks */ = {
isa = PBXGroup;
children = (
7231C033B41A0972F723C1A6 /* libPods-PicoLLMChatDemo.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
02A11944268D39A700A2AC99 /* PicoLLMChatDemo */ = {
isa = PBXNativeTarget;
buildConfigurationList = 02A11954268D39AB00A2AC99 /* Build configuration list for PBXNativeTarget "PicoLLMChatDemo" */;
buildPhases = (
1F448DADB90CE82863E78546 /* [CP] Check Pods Manifest.lock */,
02A11941268D39A700A2AC99 /* Sources */,
02A11942268D39A700A2AC99 /* Frameworks */,
02A11943268D39A700A2AC99 /* Resources */,
FA42AEB90E30635F6CCC7782 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -140,6 +118,9 @@
Base,
);
mainGroup = 02A1193C268D39A700A2AC99;
packageReferences = (
E1E013822D162B3D00DB0C2F /* XCLocalSwiftPackageReference "../../../../picollm" */,
);
productRefGroup = 02A11946268D39A700A2AC99 /* Products */;
projectDirPath = "";
projectRoot = "";
Expand All @@ -160,48 +141,6 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
1F448DADB90CE82863E78546 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-PicoLLMChatDemo-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
FA42AEB90E30635F6CCC7782 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-PicoLLMChatDemo/Pods-PicoLLMChatDemo-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-PicoLLMChatDemo/Pods-PicoLLMChatDemo-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PicoLLMChatDemo/Pods-PicoLLMChatDemo-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
02A11941268D39A700A2AC99 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down Expand Up @@ -339,13 +278,12 @@
};
02A11955268D39AB00A2AC99 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 195F7C81D2A651BE1E18D367 /* Pods-PicoLLMChatDemo.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = EU9HUJJU2X;
DEVELOPMENT_TEAM = 65723695GD;
ENABLE_PREVIEWS = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
INFOPLIST_FILE = PicoLLMChatDemo/Info.plist;
Expand All @@ -363,13 +301,12 @@
};
02A11956268D39AB00A2AC99 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = B4721F6A98EC8D37F91281AB /* Pods-PicoLLMChatDemo.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = EU9HUJJU2X;
DEVELOPMENT_TEAM = 65723695GD;
ENABLE_PREVIEWS = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
INFOPLIST_FILE = PicoLLMChatDemo/Info.plist;
Expand Down Expand Up @@ -407,6 +344,24 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCLocalSwiftPackageReference section */
E1E013822D162B3D00DB0C2F /* XCLocalSwiftPackageReference "../../../../picollm" */ = {
isa = XCLocalSwiftPackageReference;
relativePath = ../../../../picollm;
};
/* End XCLocalSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
E1E0137D2D16114E00DB0C2F /* PicoLLM */ = {
isa = XCSwiftPackageProductDependency;
productName = PicoLLM;
};
E1E013832D162B3D00DB0C2F /* PicoLLM */ = {
isa = XCSwiftPackageProductDependency;
productName = PicoLLM;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 02A1193D268D39A700A2AC99 /* Project object */;
}
Loading

0 comments on commit 9ce1256

Please sign in to comment.