I figured it out. The url is scoped and so I had to direct it to start using the scoped url. like so,
guard let selectedURL = try? result.get() else {return}
if selectedURL.startAccessingSecurityScopedResource() {
do {
if let selectedData = try? Data(contentsOf: selectedURL) {
self.coverData = selectedData
if let uiImage = UIImage(data: selectedData) {
self.coverImage = Image(uiImage: uiImage)
}
}
} catch {
print(error.localizedDescription)
}
}
selectedURL.stopAccessingSecurityScopedResource()
}
Post
Replies
Boosts
Views
Activity
in the init use themodelValue = State(initialValue value: newValue)
I am sorry i took so long to respond. i was not aware that this forum did not email me when i have a response like reddit does. And i stopped checking on it every day like i did when i first posted it. I tried your method and it did improve it a little but it was still not what i wanted. When i clicked on a link in the second navigation view it would cover that navigation list with the detail view. I decided to scrap the methodology that i was trying for and to go with a segmented button on the toolbar for tabs on catalyst and then tabview on the ios code. Thanks for all your help.
ok i think i solved that problem, i put the code in the scenedelegate not the app delegate and i dont get the error anymore. problem is that now i do not know how to actually implement a sidebar in a catalyst master/detail view using the uisplitviewcontroller? I could not find any tutorial on this and the apple article stopped at the .sidebar setting. So how do i implement a master/detail with sidebar in swiftui for catalyst?
If I did that I couldn’t use the navigation link to the Accountdetailview
that still turns the navigation links into buttons and not text.
davea,if i change the lists to vstacks, it fixes it but then it changes the links to buttons instead of text. I cant even style the buttons with plainbuttonstyle because its a text that i used.
Claude31 i tried that it does not work as expected. It puts this weird line in the middle and the bottom list still hugs the top of the list i want it to hug the bottom like on the app store app. Also for some reason this method will not work in the preview.import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
VStack {
List {
NavigationLink("Item #1", destination: Text("Item1").frame(maxWidth: .infinity, maxHeight: .infinity))
NavigationLink("Item #2", destination: Text("Item2").frame(maxWidth: .infinity, maxHeight: .infinity))
}
Spacer()
List {
NavigationLink("Item #3", destination: Text("Item3").frame(maxWidth: .infinity, maxHeight: .infinity))
}
}.frame(width: 100)
}
}
}