|
note: same as video but giving error in observevalue func inside if statement("Instance member 'webview' cannot be used on type viewcontroller") |
|
just remove keyword |
|
@ygeras thank you! Why did the code completion insert "class" here if it wasn't needed? |
|
Hi @vercordio! Good question! I am not an expert to answer that kind of question but digging into the code I noticed that when you start typing observeValue, Xcode code completion says there are actually two similar methods. So if you choose the first option it fills in the code with Key-value observing is a Cocoa programming pattern you use to notify objects about changes to properties of other objects. It's useful for communicating changes between logically separated parts of your app—such as between models and views. You can only use key-value observing with classes that inherit from NSObject. So can deduce from that, that method |
|
|
|
SPONSORED Alex is the iOS & Mac developer’s ultimate AI assistant. It integrates with Xcode, offering a best-in-class Swift coding agent. Generate modern SwiftUI from images. Fast-apply suggestions from Claude 3.5 Sonnet, o3-mini, and DeepSeek R1. Autofix Swift 6 errors and warnings. And so much more. Start your 7-day free trial today!
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.