Post

Replies

Boosts

Views

Activity

Reply to What happened to GKGameSession?
It's good to see that Game Center got some love in WWDC 2020. Still I was silently hoping they would introduce a GK Game Session 2.0. It's still not possible to easily share a Game Center game with a link or through the share sheet to other Messenger apps like WhatsApp or Telegram.
Jun ’20
Reply to How to use outline in the list?
First avoid using Data as this type already exists. Second, like @heckj already described, you need to have a data structure that has a property children. Which holds an (optional) array of the same type. I rewrote your code to show a working version: struct ContentView: View {   let testData = [     SomeData(name: "Parent One", children: [       SomeData(name: "Child One", children: nil),       SomeData(name: "Child Two", children: nil),       SomeData(name: "Child Three", children: nil),     ]),     SomeData(name: "Parent Two", children: nil)   ]   var body: some View {     List(testData, children: \.children) { data in       Text(data.name)     }   } } struct ContentView_Previews: PreviewProvider {   static var previews: some View {     ContentView()   } } struct SomeData: Identifiable {   var id: String = UUID().uuidString   var name: String   let children: [SomeData]? }
Jul ’20
Reply to iPadOS Sidebar Split Navigation View with SwiftUI
I copied your code and removed the Detail-part. struct ContentView: View {   var body: some View {     NavigationView {       SidebarView()       Text("Main")     }   } } On iPad portrait mode I have a full screen for Main with a Back-button in the top left corner to let the sidebar come in as a fly-over. If I put the iPad in landscape mode. I get about 1 third sidebar and 2 third main. I can click the sidebar icon in the top left to dismiss the sidebar and get a full screen Main view. From your story this is the expected behavior is it not? Build on xCode Version 12.0 beta (12A6159) Simulator iPad Pro (11-inch) (2nd generation)
Jul ’20
Reply to How to get collapsable sections as shown in 'Stacks, Grids, and Outlines in SwiftUI'?
It seems like they solved the issue in iOS 14 beta 2. Not in Simulator but on the hardware device itself. Altho the behavior is still very buggy. 1) When I press on a section header it get's a highlighted effect, which isn't there in the sidebar of the Files app. 2) When I collaps and expand the items, for instance the 'Version 2' section, the style of the first item get's styled two with bold and increased font, but when I collaps and expand again the last item get's styled and this swaps constantly.
Jul ’20
Reply to how to render html in swiftui
The code should work. Please note that the WebView has a different rendering system than UIKit. So you don't get the dynamic font size advantage for free. import SwiftUI import WebKit struct ContentView: View {   @State var text = "<html><body><h1>Hello World</h1></body></html>"       var body: some View {     WebView(text: $text)       .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)   } } struct WebView: UIViewRepresentable {   @Binding var text: String       func makeUIView(context: Context) -> WKWebView {     return WKWebView()   }       func updateUIView(_ uiView: WKWebView, context: Context) {     uiView.loadHTMLString(text, baseURL: nil)   } } struct ContentView_Previews: PreviewProvider {   static var previews: some View {     ContentView()   } }
Jul ’20
Reply to How to add UISearchController in SwiftUI?
UISearchController works when attached to a List. It becomes buggy when you use something other like a ScrollView or VStack. I have reported this in Apple's Feedback app and I hope others will do the same. Never the less if you like to include a UISearchController in your App. I created a Swift Package at Github named NavigationSearchBar. - https://github.com/markvanwijnen/NavigationSearchBar
Sep ’20
Reply to How should I access @AppStorage and @SceneStorage values outside of views?
I don't really understand your question, but I wrote an article about everything you should about @AppStorage and @SceneStorage on Medium, which might answer your question better. Perhaps you don't realize that with defining @AppStorage you defined a source-of-truth. If you need to access it "outside" the views perhaps its better to place the @AppStorage somewhere higher in the view hierarchy and pass it with bindings. Links: Introducing @AppStorage in SwiftUI (medium.com/swlh/introducing-appstorage-in-swiftui-470a56f5ba9e) Introducing @SceneStorage in SwiftUI: (medium.com/@crystalminds/introducing-scenestorage-in-swiftui-5a4ec1a90ca3)
Oct ’20