Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Jan 17, 2024
2 parents 331c939 + f7fa71f commit 9902303
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
- name: Calculate SHA256 Checksum
if: startsWith(matrix.job.target,'ios')
run: |
sha256sum hiddify-libcore-ios.xcframework.zip > hiddify-libcore-ios.xcframework.zip.sha256
sha256sum hiddify-libcore-ios.xcframework.zip | awk '{print $1}'> hiddify-libcore-ios.xcframework.zip.sha256
working-directory: bin
- uses: actions/upload-artifact@v3
if: ${{ success() }}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@
<key>hiddify-next-core-Package.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>Libcore</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>hiddify-next-core</key>
<dict>
<key>primary</key>
Expand Down
62 changes: 23 additions & 39 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,30 @@
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

func fetchChecksum(from url: String) throws -> String {
guard let checksumURL = URL(string: url) else {
throw NSError(domain: "Invalid URL", code: 0, userInfo: nil)
}

let checksumString = try String(contentsOf: checksumURL)
return checksumString.trimmingCharacters(in: .whitespacesAndNewlines)
}
import Foundation

let version = "draft"
let baseURL = "https://github.com/hiddify/hiddify-next-core/releases/download/"
let packageURL = "\(baseURL)\(version)/hiddify-libcore-ios.xcframework.zip"
let checksumURL = "\(packageURL).sha256"
let packageURL = baseURL + version + "/hiddify-libcore-ios.xcframework.zip"

do {
let package = Package(
name: "Libcore",
platforms: [
.iOS(.v13) // Minimum platform version
],
products: [
.library(
name: "Libcore",
targets: ["Libcore"]),
],
dependencies: [
// No dependencies
],
targets: [
.binaryTarget(
name: "Libcore",
url: packageURL,
checksum: try fetchChecksum(from: checksumURL)
)
]
)
} catch {
// Handle URL or checksum fetch errors
print("Error: \(error)")
// You might want to exit or handle the error in a way suitable for your application
// exit(1)
}
let package = Package(
name: "Libcore",
platforms: [
.iOS(.v13) // Minimum platform version
],
products: [
.library(
name: "Libcore",
targets: ["Libcore"]),
],
dependencies: [
// No dependencies
],
targets: [
.binaryTarget(
name: "Libcore",
url: packageURL,
checksum: "e42d176d32198bc33ae4f8aafa24814934bbc93cbc8747aa8a0353e8341dc3ff"
)
]
)

0 comments on commit 9902303

Please sign in to comment.