hashgraph / hedera-sdk-swift

Hedera™ SDK for Swift
Apache License 2.0
25 stars 10 forks source link

Release 0.31.0 does not compile with macos template of Xcode 15.4 #388

Closed ericleponner closed 3 weeks ago

ericleponner commented 1 month ago

Description

I created a new project using Xcode 15.4 with macOS / App template. I added hedera-sdk-swift package to the project (release 0.31.0 is automatically selected). Build fails when Xcode tries to compile hedera-sdk-swift:

/Users/eric/Library/Developer/Xcode/DerivedData/Tagada-afirnpgcsvmepebtrdnhddpmxfev/SourcePackages/checkouts/hedera-sdk-swift/Sources/Hedera/CustomFee.swift:302:17: error: type 'UInt64' does not conform to protocol 'IntegerNumber'
         amount: Rational<UInt64> = "1/1",
                 ^
 /Users/eric/Library/Developer/Xcode/DerivedData/Tagada-afirnpgcsvmepebtrdnhddpmxfev/SourcePackages/checkouts/hedera-sdk-swift/Sources/Hedera/CustomFee.swift:333:24: error: type 'UInt64' does not conform to protocol 'IntegerNumber'
     public var amount: Rational<UInt64> {
                        ^
 /Users/eric/Library/Developer/Xcode/DerivedData/Tagada-afirnpgcsvmepebtrdnhddpmxfev/SourcePackages/checkouts/hedera-sdk-swift/Sources/Hedera/CustomFee.swift:351:43: error: type 'UInt64' does not conform to protocol 'IntegerNumber'
     public mutating func amount(_ amount: Rational<UInt64>) -> Self {
                                           ^
 /Users/eric/Library/Developer/Xcode/DerivedData/Tagada-afirnpgcsvmepebtrdnhddpmxfev/SourcePackages/checkouts/hedera-sdk-swift/Sources/Hedera/CustomFee.swift:471:24: error: type 'UInt64' does not conform to protocol 'IntegerNumber'
         exchangeValue: Rational<UInt64> = "1/1",
                        ^
 /Users/eric/Library/Developer/Xcode/DerivedData/Tagada-afirnpgcsvmepebtrdnhddpmxfev/SourcePackages/checkouts/hedera-sdk-swift/Sources/Hedera/CustomFee.swift:518:31: error: type 'UInt64' does not conform to protocol 'IntegerNumber'
     public var exchangeValue: Rational<UInt64> {
                               ^
 /Users/eric/Library/Developer/Xcode/DerivedData/Tagada-afirnpgcsvmepebtrdnhddpmxfev/SourcePackages/checkouts/hedera-sdk-swift/Sources/Hedera/CustomFee.swift:536:57: error: type 'UInt64' does not conform to protocol 'IntegerNumber'
     public mutating func exchangeValue(_ exchangeValue: Rational<UInt64>) -> Self {
                                                         ^
 /Users/eric/Library/Developer/Xcode/DerivedData/Tagada-afirnpgcsvmepebtrdnhddpmxfev/SourcePackages/checkouts/hedera-sdk-swift/Sources/Hedera/Protobufs/Rational+ProtobufCodable.swift:4:37: error: no type for 'T' can satisfy both 'T == UInt64' and 'T : IntegerNumber'
 extension Rational: ProtobufCodable where T == UInt64 {
                                     ^
 /Users/eric/Library/Developer/Xcode/DerivedData/Tagada-afirnpgcsvmepebtrdnhddpmxfev/SourcePackages/checkouts/hedera-sdk-swift/Sources/Hedera/Protobufs/Rational+ProtobufCodable.swift:4:37: error: no type for 'T' can satisfy both 'T == UInt64' and 'T : SignedInteger'
 extension Rational: ProtobufCodable where T == UInt64 {
                                     ^
 /Users/eric/Library/Developer/Xcode/DerivedData/Tagada-afirnpgcsvmepebtrdnhddpmxfev/SourcePackages/checkouts/hedera-sdk-swift/Sources/Hedera/Protobufs/Rational+ProtobufCodable.swift:4:37: error: no type for 'T' can satisfy both 'T == UInt64' and 'T : SignedNumeric'
 extension Rational: ProtobufCodable where T == UInt64 {

Steps to reproduce

1) Start Xcode 15.4 2) File > New > Project

=> build fails (see above)

Additional context

No response

Hedera network

other

Version

v0.31.0

Operating system

macOS 14.6.1

ericleponner commented 1 month ago

After investigation, it looks like NumberKit 2.6.0 is not compatible with hedera-sdk-swift. If you force NumberKit to release 2.5.1 project builds successfully.

RickyLB commented 1 month ago

@ericleponner I have merged a PR that fixes this issue, making the SDK compatible with NumberKit version 2.6.0. This will be present on the SDK 0.32.0 release early next week.

cdigiacinto commented 1 month ago

@RickyLB when you will release version 0.32.0?

RickyLB commented 3 weeks ago

@cdigiacinto 0.32.0 has been released with this fix.