Post

Replies

Boosts

Views

Activity

Reply to Is it possible to use familly activity picker with storyboard
On the face of it, FamilyControls are not part of SwiftUI, so I don't see why they couldn't be used without it. Having said that, FamilyActivityPicker conforms to View, which is a SwiftUI component. In UIKit code, you could create the FamilyActivityPicker, but because it's a (SwiftUI) View, you can't directly add it to a ViewController. You would have to use a UIHostingController, which is the generic solution for adding SwiftUI to a UIKit app.
Topic: App & System Services SubTopic: General Tags:
Sep ’21
Reply to Static method 'buildBlock' requires that 'Group' conform to 'View'
struct LostFindView: View { var body: some View { VStack { Group { Text("1") Text("2") Text("3") Text("4") Text("5") Text("6") Text("7") Text("8") Text("9") Text("10") } Text("11") } } } struct LostFindView_Previews: PreviewProvider { static var previews: some View { LostFindView() } } It works for me... builds cleanly. Try the usual: Product > Clean Build Folder Quit Xcode, reload and try again Hint: It's better to paste the actual code, in a code block (rather than a screenshot). Then people who are trying to help you can easily copy-and-paste your code, to try it out. Ah... Could it be your deployment target? Try setting it to iOS 14, and see what happens.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’21
Reply to why it says "Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value"?
The most likely reason is that one of your mp4 files can't be found in the app bundle: reel_1.mp4 reel_2.mp4 Because you are force-unwrapping your file paths, a failure will result in a crash. Bundle.main.path(forResource: "reel_1", ofType: "mp4") ...returns an Optional, so if you use ! on it, and the file can't be found, the app will crash.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’21
Reply to how to randomly spawn enemies on screen
So: x is 1 or -1 enemy.position.y is always the screen height You then want to generate a random point across the screen, for enemy.position.x... You generate a random number Then multiply it by x (which can be 1 or -1) Isn't that going to generate a lot of negative x co-ordinates?! To generate a random position across the screen width, try something like: let enemyX = CGFloat.random(in: 0..<UIScreen.main.bounds.width)
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Sep ’21
Reply to tvos 15 - Siri Remote not returning in the array: GCController.controllers()
As a very simple test, I tried this: struct ContentView: View {     var body: some View {         Button("Query controllers") {             print("controllers: \(GCController.controllers())")         }     } } The first time I clicked "Query controllers", it returned: controllers: [] Clicking "Query controllers" again, it returned the siri remote: controllers: [<GCController 0x283618620 ('Siri Remote (2nd Generation)' - 0xa6f1756e8a7cb7bb)>] So perhaps you have to have some controller interaction, to populate GCController.controllers()? tvOS 15.0 Xcode 13.0
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’21