I wrote Paul Hudson on Slack, but he didn't answer unfortunately. But good idea I'll try it on Mastodon. Thank you.
Post
Replies
Boosts
Views
Activity
Hi
Thank you all for your swift response and great suggestions.
But I guess the problem isn't Xcode or the preview. I think it has something to do that I dont't pass the CoreData instance the right way. I tried once with the ".environment" but it didn't work. Does someone have an idea?
@Environment(\.managedObjectContext) var moc
static var previews: some View {
AddListView()
.environment(.managedObjectContext, DataController(name: "preview").container.viewContext))
}
}
This is how the crash looks like:
Sorry I didn't express myself clearly. I want to turn this UIKit view into a SwiftUI view. How can I do that?
Sorry I did not mean grid view but something like in this attachment. So I want to add to this view a detail view that you can view the images a bit bigger.
Yes I can do that.
var body: some View {
NavigationView {
VStack {
Image(systemName: "cross.fill")
.font(.system(size: 150))
.foregroundColor(Color(.systemRed))
Text("SOS")
.font(.system(size: 40, weight: .bold))
}
.toolbar{
ToolbarItemGroup(placement: .bottomBar) {
Image(systemName: "cross.fill")
.font(.system(size: 30.0))
.foregroundColor(Color(.systemRed))
Spacer()
NavigationLink(destination: heartTextSquareView().navigationBarBackButtonHidden(true)) {
Image(systemName: "heart.text.square")
.font(.system(size: 30.0))
.foregroundColor(Color(.systemRed))
}
Spacer()
NavigationLink(destination: keyView().navigationBarBackButtonHidden(true)) {
Image (systemName: "key")
.font(.system(size: 30.0))
.foregroundColor(Color(.systemRed))
}
Spacer()
Image (systemName: "gearshape")
.font(.system(size: 30))
.foregroundColor(Color(.systemRed))
}
}
}
}