Skip to content

Commit 5b1a305

Browse files
committed
feat: add dynamic linking option to fix SwiftUI preview issues
- Add StarknetDynamic product as dynamic library variant - Keep Starknet as static library for existing consumers - Update README with guidance on choosing the right product - Resolves SwiftUI preview link failures caused by dead symbol stripping - Fixes missing native crypto symbols (_generate_k, _Sign, etc.) Fixes #256
1 parent f50c83d commit 5b1a305

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Package.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ let package = Package(
1313
// Products define the executables and libraries a package produces, and make them visible to other packages.
1414
.library(
1515
name: "Starknet",
16+
type: .static,
17+
targets: ["Starknet"]
18+
),
19+
.library(
20+
name: "StarknetDynamic",
21+
type: .dynamic,
1622
targets: ["Starknet"]
1723
),
1824
],

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ dependencies: [
2020
Then add `starknet.swift` to the dependencies array of every target you want to use the package in.
2121
```
2222

23+
### Choosing the Right Product
24+
25+
The package offers two library products:
26+
27+
- `Starknet` – statically linked variant. Prefer this when you control the final app binary and want to avoid extra runtime bundles.
28+
- `StarknetDynamic` – dynamically linked variant. Use this for SwiftUI previews or any build pipeline that performs aggressive dead-symbol stripping.
29+
30+
If you rely on SwiftUI previews or hit missing native symbol errors (`_generate_k`, `_Sign`, etc.), switch the dependency in your target to `StarknetDynamic`.
31+
2332
## Documentation
2433
You can find the documentation of the project [here](https://docs.swmansion.com/starknet.swift/documentation/starknet/).
2534

0 commit comments

Comments
 (0)