Post

Replies

Boosts

Views

Activity

Reply to NEFilterDataProvider method handleInboundData parameter readBytes, is this data encrypted?
readBytes is just Data, so you need to decode the Data into whatever you are expecting it to be. e.g. if you are expecting a string, try something like: /// I don't have your readBytes, so I'll make a dummy one... let readBytes = Data() /// Convert to the target class you are expecting (e.g. String) guard let string = String(data: readBytes, encoding: .utf8) else { print("Error: couldn't get String from readBytes") return } /// Success... print("string: \(string)") Does that answer your question?
Jan ’22
Reply to Error -> init(coder:) has not been implemented
You have defined CVC init(coder:) to throw a fatal error. You don't show where you are initializing the CVC... ...but it seems that init(coder:) is being called, since you are seeing the error. You need to implement a proper init(coder:)... required init?(coder: NSCoder) { super.init(coder: coder) /// any other setup action here... what about viewModel? } ... or use your custom initializer instead.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jan ’22
Reply to Error -> init(coder:) has not been implemented
You are instantiating the CVC directly from your Storyboard. So you can't pass in the viewModel property. You will have to think of another way to use viewModel in CVC. For example, as a global singleton, like this... In AlbumsViewModel: static let shared = AlbumsViewModel(albumService:favouritesService:recommendationService:) // however you initialise it ...then in CVC, refer to AlbumsViewModel.shared ...or create a shortcut property let viewModel = AlbumsViewModel.shared
Topic: UI Frameworks SubTopic: UIKit Tags:
Jan ’22
Reply to Apple sample code "Detecting Human Actions in a Live Video Feed" - accessing the observations associated with an action prediction
Just wrap your Button in a condition: if someBool { Button("Another button that may or may not show") { } } So: struct ContentView: View { @State var showingAlert = false var someBool = false var body: some View { VStack { Text("Hello, world!") Button("Alert") { showingAlert.toggle() } } .alert("Here's an alert with multiple possible buttons.", isPresented: $showingAlert) { Button("OK") { } if someBool { Button("Another button that may or may not show") { } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22
Reply to How to access
This idea seems to go against the principle of encapsulation. A better approach would be for the first ViewController to make a change to a shared Model, which the second ViewController can then respond to.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jan ’22
Reply to Adding a Haptic Metronome to the Watch
There is some Apple sample code for a metronome: https://developer.apple.com/library/archive/samplecode/HelloMetronome/Listings/iOSHelloMetronome_ViewController_m.html#//apple_ref/doc/uid/TP40017587-iOSHelloMetronome_ViewController_m-DontLinkElementID_14 ...which could be adapted. Forum user @rnodern asked a more advanced version of your question: https://developer.apple.com/forums/thread/697275?answerId=700229022#700229022 ..but they haven't answered with any progress, so I don't know how serious they are. As I said on that thread, I guess it is technically possible, but I wonder if it will work in practice? I thought Apple Watch haptics might help with navigation on the motorbike, but in practice I rarely notice the buzzes. So I wonder if it will be noticeable enough to follow, while playing an instrument (or in a band).
Topic: Media Technologies SubTopic: General Tags:
Jan ’22
Reply to Error -> init(coder:) has not been implemented
Where is the error... which class, which line?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to NEFilterDataProvider method handleInboundData parameter readBytes, is this data encrypted?
readBytes is just Data, so you need to decode the Data into whatever you are expecting it to be. e.g. if you are expecting a string, try something like: /// I don't have your readBytes, so I'll make a dummy one... let readBytes = Data() /// Convert to the target class you are expecting (e.g. String) guard let string = String(data: readBytes, encoding: .utf8) else { print("Error: couldn't get String from readBytes") return } /// Success... print("string: \(string)") Does that answer your question?
Replies
Boosts
Views
Activity
Jan ’22
Reply to Error -> init(coder:) has not been implemented
How are you initializing the CVC?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Error -> init(coder:) has not been implemented
You have defined CVC init(coder:) to throw a fatal error. You don't show where you are initializing the CVC... ...but it seems that init(coder:) is being called, since you are seeing the error. You need to implement a proper init(coder:)... required init?(coder: NSCoder) { super.init(coder: coder) /// any other setup action here... what about viewModel? } ... or use your custom initializer instead.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to XCode
Xcode is only available on macOS. It will not run on Windows.
Replies
Boosts
Views
Activity
Jan ’22
Reply to Error -> init(coder:) has not been implemented
You are instantiating the CVC directly from your Storyboard. So you can't pass in the viewModel property. You will have to think of another way to use viewModel in CVC. For example, as a global singleton, like this... In AlbumsViewModel: static let shared = AlbumsViewModel(albumService:favouritesService:recommendationService:) // however you initialise it ...then in CVC, refer to AlbumsViewModel.shared ...or create a shortcut property let viewModel = AlbumsViewModel.shared
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to UIScreen.main.bounds returning incorrect size
Working in Xcode, the iPhone 8+ has a screen size (in points) of 414 x 736. This is scaled by the system, to display at (pixels) 1080 × 1920. Reference: https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to MacOS MapKit - CVDisplayLinkSetPaused alternating true/false several times per second
I agree, these spurious(?) console messages are annoying! Unfortunately, it's a common thing with new versions of Xcode. Hopefully an update will calm things down.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Apple sample code "Detecting Human Actions in a Live Video Feed" - accessing the observations associated with an action prediction
Just wrap your Button in a condition: if someBool { Button("Another button that may or may not show") { } } So: struct ContentView: View { @State var showingAlert = false var someBool = false var body: some View { VStack { Text("Hello, world!") Button("Alert") { showingAlert.toggle() } } .alert("Here's an alert with multiple possible buttons.", isPresented: $showingAlert) { Button("OK") { } if someBool { Button("Another button that may or may not show") { } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to How to access
This idea seems to go against the principle of encapsulation. A better approach would be for the first ViewController to make a change to a shared Model, which the second ViewController can then respond to.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Adding a Haptic Metronome to the Watch
There is some Apple sample code for a metronome: https://developer.apple.com/library/archive/samplecode/HelloMetronome/Listings/iOSHelloMetronome_ViewController_m.html#//apple_ref/doc/uid/TP40017587-iOSHelloMetronome_ViewController_m-DontLinkElementID_14 ...which could be adapted. Forum user @rnodern asked a more advanced version of your question: https://developer.apple.com/forums/thread/697275?answerId=700229022#700229022 ..but they haven't answered with any progress, so I don't know how serious they are. As I said on that thread, I guess it is technically possible, but I wonder if it will work in practice? I thought Apple Watch haptics might help with navigation on the motorbike, but in practice I rarely notice the buzzes. So I wonder if it will be noticeable enough to follow, while playing an instrument (or in a band).
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to XPC for realtime
You may be overcomplicating it. The app can include the network code, and handle any errors that arise. (No need for any crashes!)
Replies
Boosts
Views
Activity
Jan ’22
Reply to No "Features" section on my App Store Connect page
The "updated App Store submission experience" is something that you had to sign up to. It will automatically roll out to all developers on 25 January. {This includes the product page optimization feature} If you want it before then, you can still sign up for it: https://developer.apple.com/app-store-connect/submission-update/enable/
Replies
Boosts
Views
Activity
Jan ’22
Reply to ScrollViewReader ignores safeAreaInset on macOS?
{Post removed, as I thought it was working for me, but it isn't...}
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to ScrollViewReader ignores safeAreaInset on macOS?
Try this: When scrolling, replace anchor .bottom with .top scrollView.scrollTo(49, anchor: .top) This might seem counter-intuitive, but it works... ...and looking through some old code, I see that I've used it before.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22