Post

Replies

Boosts

Views

Activity

WebKit Loading problem
I'm tired of opening up safari to open developer.apple.com so I'm trying to embed the website into an app, but sth is definitely wrong. It's been loading for ten mins and is still white. here's the code import SwiftUI import WebKit import UIKit struct WebViewPage : UIViewRepresentable { func makeUIView(context: Context) -> WKWebView { return WKWebView() } func updateUIView(_ uiView: WKWebView, context: Context) { let req = URLRequest(url: URL(string:"developer.apple.com")!) uiView.load(req) } } #if DEBUG struct WebViewPage_Previews : PreviewProvider { static var previews: some View { WebViewPage() } } #endif app delegate: import SwiftUI @main struct Developer_WebpageApp: App { var body: some Scene { WindowGroup { WebViewPage() } } }
Topic: Safari & Web SubTopic: General Tags:
0
0
407
Apr ’22
@AppStorage storing a self defined structure
How can I store a struct in @AppStorage? I've been trying struct TodoItem: Codable, Hashable, Identifiable {     var id: UUID = UUID()     var name: String = "New Todo"     var description: String = "Description here..."     var done: Bool } @AppStorage("todo") var todo: [TodoItem] = [] // No exact matches in call to initializer  Any help is appreciated🙏🙏
0
0
439
May ’22
@AppStorage
Still about appstorage Can a store a @StateObject in @AppStorage? I can't do this: @AppStorage("Data") // No exact matches in call to initializer  @StateObject private var Data = TodoData()
0
0
593
May ’22
Export SwiftUI View
I know this is a strange and easy question. but JUST CANT FIND ANY REFERENCE aaaaaaaa I'm using SwiftUI and wants to export to PDF (best I can find Creating PDFs on MacOS without UIKit) export to image export to HTML export to everything possible etc BONUS print the page I can only find UIKit support and they are all outdated. AND IF POSSIBLE how to integrate ShareLink to share these(PDF, Image, HTML, etc) and write them onto disk using NSSavePane? even better how to do this on a of the platforms (I know I'm greedy😂) Thanks for any help🙏
0
0
825
Jun ’22
Enumerate the child view of a View
If we have this SwiftUI View: Text("Hello") Image("Some Image") We have two Views, and we refract them into a single one: struct MyView: View { var body: some View { Text("Hello") Image("Some Image") } } If we use it in most cases, it is ordered into an implicit VStack. But, if we do this: List { MyView() } SwiftUI will automatically split MyView into two separate Views. My question is that if I have this: @ViewBuilder func pageView(_ views: () -> View) -> View { } How can I enumerate the child Views of the variable view just like in List?
0
0
814
Aug ’22
iPhone 14 Pro Series Simulator bug
I wrote a macOS app and I added iPhone support Now it looks like this: I thought it was some sort of .frame or sth like that I've accidentally added But then I started with a fresh macOS project and added iPhone support, and now it's still like that: I reckon that's because I've set the target os to iOS 15.4 because when I update to 16 there's no problem Is it because Xcode can't compile UI for a 14 pro's screen for below iOS 16? But then again, why does the preview work?
0
0
937
Oct ’22
How to present a UIViewController in a SKScene
I'm trying to integrate AR into my app, and I want to be able to present a the UIViewController containing the ar view after pressing a sprite in SKScene. I'm trying to look for a way to present this view controller in touchesBegan however I'm not able to find any reference on this. I'd really appreciate any help.
0
0
673
Feb ’24