Yes, I'm seeing this too.
var timer: AnyCancellable? is throwing the same error:
@Observable requires property 'timer' to have an initial value (from macro 'Observable')
EDIT: In my case making the timer: AnyCancellable? = nil removes the error
Here's my code:
@Observable class SubscriberViewModel {
public var count: Int = 0
var timer: AnyCancellable?
func setupTimer() {
timer = Timer
.publish(every: 1, on: .main, in: .common)
.autoconnect()
.sink { [weak self] _ in
self?.count += 1
}
}
}
Post
Replies
Boosts
Views
Activity
@rabi
Are you under the impression that all combinations of metadataObjectTypes will work again in iOS 16 beta 3? For example, the following is likely to work again?
output.metadataObjectTypes = [AVMetadataObject.ObjectType.qr,
AVMetadataObject.ObjectType.dataMatrix,
AVMetadataObject.ObjectType.ean13,
AVMetadataObject.ObjectType.ean8,
AVMetadataObject.ObjectType.upce,
AVMetadataObject.ObjectType.code39,
AVMetadataObject.ObjectType.code39Mod43,
AVMetadataObject.ObjectType.code93,
AVMetadataObject.ObjectType.code128,
AVMetadataObject.ObjectType.pdf417]
Any updates on this one? Were you able to find a solution, I'm running into a similar issue.
How might this work with SwiftUI?
I'm running into this as well -- did you have any luck solving it?
This worked for me. Thanks!
same here. reinstalling Xcode did not work.