Post

Replies

Boosts

Views

Activity

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 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 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 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 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