Hi, I'm writing like this in code swift 5.9, it's working:
UIStackView().then($0.addSubview).then {
$0.axis = .vertical
$0.addArrangedSubviews(...)
}
However, when I upgrade to swift 6.0 or 6.2, the compiler is complaining:
Converting function value of type '@mainactor (UIStackView) throws -> Void' to '(UIStackView) throws -> Void' loses global actor 'MainActor'
I tried config in build setting's Default actor isolation = MainActor but it's not working. i suspect the cause is in the spm defination:
// swift-tools-version:5.0
maybe this could help fix it? https://www.avanderlee.com/concurrency/default-actor-isolation-in-swift-6-2/
// swift-tools-version: 6.2
...
.target(
name: "DefaultActorIsolationPackage",
swiftSettings: [
/// You can add a new `defaultIsolation` Swift setting to any of your SPM targets.
.defaultIsolation(MainActor.self)
]
)
I'm not totally sure about this, as i'm not an expert on those Actors thingy.
Hi, I'm writing like this in code swift 5.9, it's working:
However, when I upgrade to swift 6.0 or 6.2, the compiler is complaining:
I tried config in build setting's
Default actor isolation = MainActorbut it's not working. i suspect the cause is in the spm defination:maybe this could help fix it? https://www.avanderlee.com/concurrency/default-actor-isolation-in-swift-6-2/
I'm not totally sure about this, as i'm not an expert on those Actors thingy.