Skip to content

Commit

Permalink
Sendable Swift Types (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
CyonAlexRDX authored Mar 27, 2024
1 parent d2f1495 commit d85164e
Show file tree
Hide file tree
Showing 56 changed files with 10 additions and 56 deletions.
11 changes: 9 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

import PackageDescription

let swiftSettings: [SwiftSetting] = [
.enableExperimentalFeature("StrictConcurrency"),
.unsafeFlags(["-warnings-as-errors"])
]

let sargonBinaryTargetName = "SargonCoreRS"
let binaryTarget: Target
let useLocalFramework = true
Expand Down Expand Up @@ -49,15 +54,17 @@ let package = Package(
.target(
name: "Sargon",
dependencies: [.target(name: "SargonUniFFI")],
path: "apple/Sources/Sargon"
path: "apple/Sources/Sargon",
swiftSettings: swiftSettings
),
.testTarget(
name: "SargonTests",
dependencies: [
.target(name: "Sargon"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
path: "apple/Tests"
path: "apple/Tests",
swiftSettings: swiftSettings
),
]
)
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension AccessControllerAddress: @unchecked Sendable {}
extension AccessControllerAddress: AddressProtocol {}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension AccountAddress: @unchecked Sendable {}
extension AccountAddress: EntityAddressProtocol {}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension AddressOfAccountOrPersona: @unchecked Sendable {}
extension AddressOfAccountOrPersona: AddressProtocol {}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension ComponentAddress: @unchecked Sendable {}
extension ComponentAddress: AddressProtocol {}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension IdentityAddress: @unchecked Sendable {}
extension IdentityAddress: EntityAddressProtocol {}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension LegacyOlympiaAccountAddress: @unchecked Sendable {}
extension LegacyOlympiaAccountAddress: BaseAddressProtocol {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension NonFungibleResourceAddress: @unchecked Sendable {}
extension NonFungibleResourceAddress: AddressProtocol {}

extension NonFungibleResourceAddress {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension PackageAddress: @unchecked Sendable {}
extension PackageAddress: AddressProtocol {}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension PoolAddress: @unchecked Sendable {}
extension PoolAddress: AddressProtocol {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension ResourceAddress: @unchecked Sendable {}
extension ResourceAddress: AddressProtocol {}

extension ResourceAddress {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension ValidatorAddress: @unchecked Sendable {}
extension ValidatorAddress: AddressProtocol {}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension VaultAddress: @unchecked Sendable {}
extension VaultAddress: AddressProtocol {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension AccountPath: @unchecked Sendable {}
extension AccountPath: SargonModel, CAP26PathProtocol {}

extension AccountPath {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
public typealias BIP44LikePath = Bip44LikePath

extension BIP44LikePath: @unchecked Sendable {}
extension BIP44LikePath: SargonModel, HDPathProtocol {}

extension BIP44LikePath: CustomStringConvertible {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
public typealias CAP26Path = Cap26Path

extension CAP26Path: @unchecked Sendable {}
extension CAP26Path: SargonModel, CAP26PathProtocol {
public func embed() -> CAP26Path {
self
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
public typealias GetIDPath = GetIdPath

extension GetIDPath: @unchecked Sendable {}
extension GetIDPath {
public static let `default`: Self = defaultGetIdPath()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension IdentityPath: @unchecked Sendable {}
extension IdentityPath: SargonModel, CAP26PathProtocol {}

extension IdentityPath {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension Mnemonic: @unchecked Sendable {}
extension Mnemonic: SargonModel {}

extension Mnemonic: CustomStringConvertible {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension Hash: @unchecked Sendable {}
extension Hash: SargonModel {}

extension Hash {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension IntentHash: @unchecked Sendable {}
extension IntentHash: SargonModel {}

extension IntentHash: CustomStringConvertible {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension PublicKeyHash: @unchecked Sendable {}
extension PublicKeyHash: SargonModel {}

extension PublicKeyHash {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension SignedIntentHash: @unchecked Sendable {}
extension SignedIntentHash: SargonModel {}

extension SignedIntentHash: CustomStringConvertible {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension Ed25519PublicKey: @unchecked Sendable {}
extension Ed25519PublicKey: PublicKeyProtocol {}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension PublicKey: @unchecked Sendable {}
extension PublicKey: PublicKeyProtocol {}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension Secp256k1PublicKey: @unchecked Sendable {}
extension Secp256k1PublicKey: PublicKeyProtocol {}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension Nonce: @unchecked Sendable {}
extension Nonce: SargonModel {}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension SignatureWithPublicKey: @unchecked Sendable {}
extension SignatureWithPublicKey: SargonModel {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension Exactly29Bytes: @unchecked Sendable {}
extension Exactly29Bytes: ExactlyNBytesProtocol {
public static let length = 29
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension Exactly32Bytes: @unchecked Sendable {}
extension Exactly32Bytes: ExactlyNBytesProtocol {
public static let length = 32
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension Exactly33Bytes: @unchecked Sendable {}
extension Exactly33Bytes: ExactlyNBytesProtocol {
public static let length = 33
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension Exactly64Bytes: @unchecked Sendable {}
extension Exactly64Bytes: ExactlyNBytesProtocol {
public static let length = 64
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension Exactly65Bytes: @unchecked Sendable {}
extension Exactly65Bytes: ExactlyNBytesProtocol {
public static let length = 65
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension Decimal192: @unchecked Sendable {}
extension Decimal192: SargonModel {}

#if DEBUG
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension DisplayName: @unchecked Sendable {}
extension DisplayName: SargonModel {}

extension DisplayName: CustomStringConvertible {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension LocaleConfig: @unchecked Sendable {}
extension LocaleConfig {
public init(locale: Locale) {
self.init(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
public typealias NetworkID = NetworkId

extension NetworkID: @unchecked Sendable {}
extension NetworkID: SargonModel {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
public typealias NonFungibleGlobalID = NonFungibleGlobalId
extension NonFungibleGlobalID: @unchecked Sendable {}
extension NonFungibleGlobalID: SargonModel {}

extension NonFungibleGlobalID {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
public typealias NonFungibleLocalID = NonFungibleLocalId

extension NonFungibleLocalID: @unchecked Sendable {}
extension NonFungibleLocalID: SargonModel {}

extension NonFungibleLocalID: CustomStringConvertible {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
public typealias NonFungibleLocalIDString = NonFungibleLocalIdString
extension NonFungibleLocalIDString: @unchecked Sendable {}
extension NonFungibleLocalIDString: SargonModel {}

#if DEBUG
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension SargonBuildInformation: @unchecked Sendable {}
extension SargonBuildInformation: SargonModel {}

extension SargonBuildInformation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@
import Foundation

public typealias SargonError = CommonError
extension SargonError: @unchecked Sendable {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension Account: @unchecked Sendable {}
extension Account: EntityProtocol {}

extension Account {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
public typealias AppearanceID = AppearanceId

extension AppearanceID: @unchecked Sendable {}
extension AppearanceID: SargonModel {}
extension AppearanceID: Identifiable {
public typealias ID = UInt8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension ThirdPartyDeposits: @unchecked Sendable {}
extension ThirdPartyDeposits: SargonModel {}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension FactorSource: @unchecked Sendable {}
extension FactorSource: SargonModel {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension Profile: @unchecked Sendable {}
extension Profile: SargonModel {}

extension Profile: Identifiable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension Blob: @unchecked Sendable {}
extension Blob: SargonModel {}

extension Blob: CustomStringConvertible {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension Blobs: @unchecked Sendable {}
extension Blobs: SargonModel {}

extension Blobs: ExpressibleByArrayLiteral {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension IntentSignature: @unchecked Sendable {}
extension IntentSignature: SargonModel {}
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
extension SignedIntent: @unchecked Sendable {}
extension SignedIntent: SargonModel {}

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extension TransactionManifest: @unchecked Sendable {}
extension TransactionManifest: SargonModel {}

// MARK: Build Manifest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension PerAssetTransfers: @unchecked Sendable {}
extension PerAssetTransfers: SargonModel {}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extension StakeClaim: @unchecked Sendable {}
extension StakeClaim: SargonModel {}

This file was deleted.

1 change: 1 addition & 0 deletions uniffi.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[bindings.swift]
module_name = "Sargon"
experimental_sendable_value_types = true

[bindings.kotlin]
package_name = "com.radixdlt.sargon"
Expand Down

0 comments on commit d85164e

Please sign in to comment.