Posts

Post marked as solved
1 Replies
851 Views
In the following playground test, when the button is clicked, the block make is executed and a new value is passed in, why is the @State property text in ChildView always the initial value of 0. import PlaygroundSupport import SwiftUI struct ParentView: View {     @State var i: Int = 0     @State var make: (String) -> ChildView     var body: some View {         VStack {             make("\(i)")             Button {                 i += 1             } label: {                 Text("CLICK ME")             }         }     }     init(@ViewBuilder make: @escaping (String) -> ChildView) {         self.make = make     } } struct ChildView: View {     @State var text = ""     var body: some View {         Text(text)     } } struct ContentView: View {     var body: some View {         ParentView { str in             ChildView(text: str)         }     } } PlaygroundPage.current.setLiveView(ContentView())
Posted
by Skifary.
Last updated
.
Post not yet marked as solved
3 Replies
563 Views
MultipeerConnectivity use NSNetService to register a bonjour service with 'local.' domain, iPhone A and iPhone B can find each other without a local network. For example, iPhone A is connecting to wifi A and iPhone B is connecting to wifi B, but they also can find each other. Are they on a private local network or does bonjour support a p2p connection without a local network?
Posted
by Skifary.
Last updated
.