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()
}
}
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
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🙏🙏
I can now how define part of the about page but how about the whole?
Thanks
better in swiftUI
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()
How could I create an icon with an alpha/beta/dev badge?
like this⬇️
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🙏
How can I achieve a source code editor in SwiftUI like Xcode, highlighting all the keywords and things like that. I've tried Regex + AttributedString... To hard... Anyone has any idea?
Because of some problems I turn again to Monterey
in this thread, @ekimo says that to use ad hoc you need to archive a iOS App
however:
what did I did wrong?
I had registered a seat in the online Shanghai App Accelerator lecture about Swift Charts, tomorrow in the morning
I just found out that I had a class at the same time... Can I cancel my registration?
I'm trying to make an app that will let the user put their phone down for a moment. How can I keep the phone locked in the same interface for a certain amount of time, no matter what method the user uses? I've seen lots of apps doing that. (I'm using SwiftUI)
PS Sorry can't think of an appropriate tag
Can I export a SwiftUI Color / UIKitUIColor / AppKit NSColor to a .clr file? How?
Bonus: Can I transfer them to each other?
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?
MacBook Pro 13.3" - Y4QVXL9FGW
M2 8-core
24GB Unified memory
1T Solid Disk
MacOS 12.5.1 (21G83)
The screen flash pink and restarted again. No kernel crash log or warning anyhow.
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?
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.