-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// swift-tools-version:5.3 | ||
import PackageDescription | ||
import Foundation | ||
|
||
let package = Package( | ||
name: "LibXMTP", | ||
platforms: [ | ||
.iOS(.v13), | ||
.macOS(.v11) | ||
], | ||
products: [ | ||
.library( | ||
name: "LibXMTP", | ||
targets: ["LibXMTP", "LibXMTPRust"]), | ||
], | ||
targets: [ | ||
.target( | ||
name: "LibXMTP", | ||
dependencies: ["LibXMTPRust"], | ||
path: "Sources/LibXMTP" | ||
), | ||
.binaryTarget( | ||
name: "LibXMTPRust", | ||
path: "LibXMTPRust.xcframework") | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# LibXMTP Swift | ||
|
||
Swift Package and Cocoapod that wraps an XCFramework emitted by the `bindings_ffi` crate in [libxmtp](https://github.com/xmtp/libxmtp) | ||
|
||
|
||
## Usage | ||
|
||
**NOTE**: This package is NOT meant to be directly consumed by end users. Instead see [xmtp-ios](https://github.com/xmtp/xmtp-ios) which depends upon this package. | ||
|
||
|
||
### For testing purposes | ||
|
||
Reference in Package.swift: | ||
``` | ||
... | ||
.package(url: "https://github.com/xmtp/libxmtp-swift", from: "0.0.1-beta0") | ||
... | ||
``` | ||
Reference in Podspec: | ||
``` | ||
... | ||
spec.dependency 'LibXMTP', '= 0.0.1-beta0' | ||
... | ||
``` | ||
|
||
## Diagram | ||
|
||
``` | ||
┌────────────────────────────────────┬─────────────────────────────┬─────────────────────────────────┐ | ||
│ │ │ │ | ||
│ xmtp/libxmtp: Shared Rust Code │ xmtp/libxmtp-swift │ xmtp/xmtp-ios - iOS SDK │ | ||
│ - xmtp-networking │ - Git repo to host Swift │ - Existing iOS xmtp SDK │ | ||
│ - xmtp-proto │ Package │ - Consumes libxmtp-swift as │ | ||
│ | │ - Also contains Podspec │ a Cocoapod via spec.dependency │ | ||
│ ---> bindings_swift │ for LibXMTP pod │ │ | ||
│ │ ┌──────────────────────┐ │ │ | ||
│ ┌──────────┐ ┌───────────────┐ │ ┌─►│-Package.swift │ │ │ | ||
│ │xmtp-proto├────►│xmtp-networking│ │ │ │-LibXMTPRust.xcfra... │ │ ┌──────────────────┐ │ | ||
│ └──────────┘ └─────┬─────────┘ │ │ │-Sources/... │ │ │ XMTP.podspec │ │ | ||
│ │ │ │ │ - [Generated files] │ │ │ Package.swift │ │ | ||
│ ┌───────────────▼────┐ │ │ └─────────┬────────────┘ │ ┌──► - │ │ | ||
│ │libxmtp/ │ │ │ │ Swift Pkg │ │ │ import LibXMTP │ │ | ||
│ │ bindings_ffi │ │ │ └──────────────┼─┘ │ │ │ | ||
│ │ w/ uniffi │ │ │ Github url │ └────────┬─────────┘ │ | ||
│ └──────────┬─────────┘ │ ├────────┐ or Cocoapod │ │ │ | ||
│ │ │ │filecopy│ ├─────────────▼───────────────────┤ | ||
│ Output: │ │ ├────────┘ │xmtp/xmtp-react-native │ | ||
│ ┌────────────────▼─────────┐ │ │ │ - consumes xmtp/xmtp-ios │ | ||
│ │ LibXMTPRust.xcframework ├──────┼─┘ │ as a Cocoapod │ | ||
│ └──────────────────────────┘ │ │ │ | ||
│ │ │ │ | ||
└────────────────────────────────────┴─────────────────────────────┴─────────────────────────────────┘ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Pod::Spec.new do |s| | ||
s.name = 'LibXMTP' | ||
s.version = '0.0.1-beta0' | ||
s.summary = 'XMTP shared Rust code that powers cross-platform SDKs' | ||
|
||
s.homepage = 'https://github.com/xmtp/libxmtp-swift' | ||
s.license = { :type => 'MIT', :file => 'LICENSE' } | ||
s.author = { 'XMTP Labs' => '[email protected]' } | ||
s.source = { :git => 'https://github.com/xmtp/libxmtp-swift.git', :tag => s.version.to_s } | ||
|
||
s.platform = :ios, '13.0', :macos, '11.0' | ||
s.swift_version = '5.3' | ||
|
||
s.vendored_frameworks = 'LibXMTPRust.xcframework' | ||
|
||
s.source_files = 'Sources/LibXMTP/**/*' | ||
end |