Posts

Post not yet marked as solved
2 Replies
4.8k Views
If you build a WKWebView app you like to enable window.print() to let you print a page, or at least when a user chooses File > Print you like them to be able to print the web page they are currently viewing. How am I able to do this with WebKit on OSX?
Posted Last updated
.
Post marked as solved
3 Replies
3.6k Views
I tried to replicate the code as shown in Stacks, Grids, and Outlines in SwiftUI - https://developer.apple.com/videos/play/wwdc2020/10031/ (12:35). They make it feel like it's a very easy thing to do. Just insert a Section and as you could see in the video it will immediately become a collapsable view. Add a header to the section and it will get the bolder text style. I wasn't able to replicate this. xCode Version 12.0 beta (12A6159) Below you can find the code I used. The expected result would be nicely styled, collapsable section headers. The actual result is a non-collapsable section with a weird underline under the name and no arrow.   let model: Model = Model()       @State private var selection: Set<String> = []   var body: some View {     NavigationView {       List(selection: $selection) {         ForEach(model.canvases) { canvas in           Section(header: Text(canvas.name)) {             OutlineGroup(canvas.graphics, children: \.children) { graphic in               Label(graphic.name, systemImage: graphic.icon)             }           }         }       }       .listStyle(SidebarListStyle())       .navigationTitle("Graphics")     }   } } struct ContentView_Previews: PreviewProvider {   static var previews: some View {     ContentView()   } } It uses this simple model to hold the canvases and graphics: struct Model: Identifiable {   let id: String = UUID().uuidString   let canvases: [Canvas] = [     Canvas(name: "Main", graphics: [       Graphic(name: "Rectangle", icon: "rectangle.fill"),       Graphic(name: "Oval", icon: "circle.fill"),       Graphic(name: "Group", icon: "rectangle.3.offgrid", children: [         Graphic(name: "Rectangle", icon: "rectangle.fill"),         Graphic(name: "Rectangle", icon: "rectangle.fill"),         Graphic(name: "Rectangle", icon: "rectangle.fill")       ]),       Graphic(name: "Group", icon: "rectangle.3.offgrid", children: [         Graphic(name: "Rectangle", icon: "rectangle.fill"),         Graphic(name: "Rectangle", icon: "rectangle.fill"),         Graphic(name: "Rectangle", icon: "rectangle.fill")       ])     ]),     Canvas(name: "Highlights", graphics: [       Graphic(name: "Triangle", icon: "triangle.fill"),       Graphic(name: "Triangle", icon: "triangle.fill")     ]),     Canvas(name: "Version 2", graphics: [       Graphic(name: "Rectangle", icon: "triangle.fill"),       Graphic(name: "Oval", icon: "circle.fill"),       Graphic(name: "Triangle", icon: "triangle.fill")     ]),   ] } struct Canvas: Identifiable {   var id: String = UUID().uuidString   var name: String   let graphics: [Graphic] } struct Graphic: Identifiable {   var id: String = UUID().uuidString   var name: String   var icon: String   var children: [Graphic]? }
Posted Last updated
.
Post not yet marked as solved
0 Replies
450 Views
I am developing a SwiftUI iPad app and I like to see how the interface looks when the device is held in landscape mode. I am using the latest Version 12.0 beta (12A6159). However there seems to be no setting to switch between landscape and portrait for the SwiftUI PreviewProvider. Is this not implemented yet?
Posted Last updated
.
Post not yet marked as solved
0 Replies
446 Views
I just watched the newly available “What’s new for web developers” from WWDC2020. But they don’t go into depth as to which. It is not clear to me if they finally catch up. I think push notifications are a great way to let your web audience know there is new content available on your website.
Posted Last updated
.
Post not yet marked as solved
2 Replies
716 Views
So I watched the 2016 session 'What's New in Game Center' a great update on the 2011 and 2013 Game Center sessions. Moving from a restricted Game Center approach to a more Cloud Based approach.What I liked about the GKGameSession framework:Larger player count limits. 2-16 Real-Time players opposed to 2-4 in GKMatch. 2-100 players Turn Based instead of 2-16 players with GKTurnedBasedMatch. Opening the door for more real time party type of games.Combine Turn Based with Real-Time (This is amazing).No specific structure. In GKTurnBasedMatch it was very specific in which order the messages were being sent, you had all the freedom in GKGameSession which opened the door to all kinds of use cases.Easy way to get people into your game by sharing the URL.I got so excited after watching that video (from 2016) I wanted to make all sorts of cool things with it only to find out now in iOS13 it is totally deprecated. Did they ever mention why? I am so dissapointed!!!I know it didn't have Match Making, but that was limited anyways to "whoever wanted to play a game". I saw potential to have a public Cloud Kit database that holds the ELO-ranking of Game Kit players playing my game, then when a player likes to play a game you could retrieve the players marked with wanting to play a game and do your own algoritm to see if it's a match and if so fetch the URL and join the game. Or have a closed session where you shared the URL with your friends over iMessage or WhatsApp. GKGameSession had so much potential especially in the bridge between Turn Based and Real Time. Hopefully they will give it some love soon.So, again, my question.. What happened to GKGameSession?
Posted Last updated
.
Post not yet marked as solved
0 Replies
565 Views
I have an iOS-app that users can select a folder via UIDocumentPickerViewController - https://developer.apple.com/documentation/uikit/uidocumentpickerviewcontroller to add it under the Favorites section. This folder can also be a Volume, such as the USB drive. The good thing. When I subclass NSFilePresenter - https://developer.apple.com/documentation/foundation/nsfilepresenter and use the Volume-URL, every change to that Volume is reported. The bad thing. It seems like there is no way to figure out if that volume is available or not. I overwritten every subclass method in NSFilePresenter - https://developer.apple.com/documentation/foundation/nsfilepresenter. However if I unplug the USB nothing is reporter, nor if I plug it in again. The reason as to why I want to get reported is to hide the location from the Favorites section if it is unplugged and unavailable, vice versa I like to show the location when the USB is plugged in again.
Posted Last updated
.