Dev1an / Swift-Atem

Blackmagic Design Atem network protocol implementation in swift 5.1 using NIO 2
MIT License
59 stars 27 forks source link

Swift 5 iOS incompatibility #7

Closed ReeceRobinson closed 4 years ago

ReeceRobinson commented 4 years ago

When compiling a test project with dependency .package(name: "Atem", url: "https://github.com/Dev1an/Swift-Atem", from: "1.0.0"), and target iOS I get the following compile error:

.../SourcePackages/checkouts/Swift-Atem/Sources/Atem/Connection.swift:101:33: error: 'random()' is unavailable in Swift: Use arc4random instead.
                let randomNumber = UInt32(Int(random()) % Int(UInt16.max))
                                              ^~~~~~
Darwin.random:2:13: note: 'random()' has been explicitly marked unavailable here
public func random() -> Int
            ^

Replacing random() with arc4random() fixes this problem.

Xcode: 11.6 Apple Swift version 5.2.4

Dev1an commented 4 years ago

This should be fixed in version "1.1.1"... Can you check if that resolves your issue?