Post

Replies

Boosts

Views

Activity

SwiftUI List Row Background not Rendering Off Screen
Hi there! I've been able to get the .listRowBackground() modifier to work in SwiftUI (with iOS 15) but am experiencing a weird graphical issue where rows that start off screen do not have the correct background colour until they appear on screen then off again. Not sure if there is a way to force all elements to render but as far as I can see I am using the modifier correctly. Any help is greatly appreciated! Anthony Code: var body: some View {         ZStack {             Color.theme.darkTheme                 .edgesIgnoringSafeArea(.all)             VStack {             ForEach(Array(array.keys), id: \.self) { key in                     List {                         ForEach(systemFaults[key]!, id: \.self) { fault in                             GenericItemView(label: "FAULT ID", item: "\(fault.faultID)")                             GenericItemView(label: "IS ACTIVE", item: fault.isActive ? "TRUE" : "FALSE")                             GenericItemView(label: "SET COUNT", item: "\(fault.setCount)")                             GenericItemView(label: "LAST TIMESTAMP", item: "\(fault.timestampSeconds) secs")                         }                         .listRowBackground(Color.theme.darkerAccent)                     }                     Spacer()                 }             }         }     } Generic Item view is a simple HStack to display the text and associated value. Screenshots Initial Sheet being presented Bottom Entries in the List Off Screen after Scrolling Up
3
2
1.6k
Jul ’22
'File' couldn’t be moved because you don’t have permission to access 'Documents'
Hi there, I am attempting to move a file to the documents folder programmatically within my iOS app. See below for a code snippet, nothing crazy just simple FileManager interactions. func moveZip(sourceUrl: URL) -> URL? {         let destinationUrl: URL = getDocumentsDirectory().appendingPathComponent(sourceUrl.lastPathComponent)         do {             if FileManager.default.fileExists(atPath: destinationUrl.path) {                 try FileManager.default.removeItem(atPath: destinationUrl.path)             }             try FileManager.default.moveItem(atPath: sourceUrl.path, toPath: destinationUrl.path)                 return destinationUrl         } catch {             print(error.localizedDescription)             return nil         }     } sourceUrl = file:///private/var/mobile/Containers/Shared/AppGroup/XXXXXXXXXXXXXXXXXXXXX/File%20Provider%20Storage/Work/file.zip destinationUrl = file:///var/mobile/Containers/Data/Application/XXXXXXXXXXXXXXXXXXXXX/Documents/file.zip Once I hit the line try FileManager.default.moveItem call I fail out with the following error: “file.zip” couldn’t be moved because you don’t have permission to access “Documents”. I believe I'm accessing everything correctly and have tried to dig into any possible info.plst access privileges but I haven't found anything yet. Running Xcode Version 13.0 beta and targeting an iPhone 11 Pro Max running iOS v14.7. Any help is appreciated! Thanks!
4
0
5.7k
Jan ’22
SwiftUI List Row Background not Rendering Off Screen
Hi there! I've been able to get the .listRowBackground() modifier to work in SwiftUI (with iOS 15) but am experiencing a weird graphical issue where rows that start off screen do not have the correct background colour until they appear on screen then off again. Not sure if there is a way to force all elements to render but as far as I can see I am using the modifier correctly. Any help is greatly appreciated! Anthony Code: var body: some View {         ZStack {             Color.theme.darkTheme                 .edgesIgnoringSafeArea(.all)             VStack {             ForEach(Array(array.keys), id: \.self) { key in                     List {                         ForEach(systemFaults[key]!, id: \.self) { fault in                             GenericItemView(label: "FAULT ID", item: "\(fault.faultID)")                             GenericItemView(label: "IS ACTIVE", item: fault.isActive ? "TRUE" : "FALSE")                             GenericItemView(label: "SET COUNT", item: "\(fault.setCount)")                             GenericItemView(label: "LAST TIMESTAMP", item: "\(fault.timestampSeconds) secs")                         }                         .listRowBackground(Color.theme.darkerAccent)                     }                     Spacer()                 }             }         }     } Generic Item view is a simple HStack to display the text and associated value. Screenshots Initial Sheet being presented Bottom Entries in the List Off Screen after Scrolling Up
Replies
3
Boosts
2
Views
1.6k
Activity
Jul ’22
'File' couldn’t be moved because you don’t have permission to access 'Documents'
Hi there, I am attempting to move a file to the documents folder programmatically within my iOS app. See below for a code snippet, nothing crazy just simple FileManager interactions. func moveZip(sourceUrl: URL) -> URL? {         let destinationUrl: URL = getDocumentsDirectory().appendingPathComponent(sourceUrl.lastPathComponent)         do {             if FileManager.default.fileExists(atPath: destinationUrl.path) {                 try FileManager.default.removeItem(atPath: destinationUrl.path)             }             try FileManager.default.moveItem(atPath: sourceUrl.path, toPath: destinationUrl.path)                 return destinationUrl         } catch {             print(error.localizedDescription)             return nil         }     } sourceUrl = file:///private/var/mobile/Containers/Shared/AppGroup/XXXXXXXXXXXXXXXXXXXXX/File%20Provider%20Storage/Work/file.zip destinationUrl = file:///var/mobile/Containers/Data/Application/XXXXXXXXXXXXXXXXXXXXX/Documents/file.zip Once I hit the line try FileManager.default.moveItem call I fail out with the following error: “file.zip” couldn’t be moved because you don’t have permission to access “Documents”. I believe I'm accessing everything correctly and have tried to dig into any possible info.plst access privileges but I haven't found anything yet. Running Xcode Version 13.0 beta and targeting an iPhone 11 Pro Max running iOS v14.7. Any help is appreciated! Thanks!
Replies
4
Boosts
0
Views
5.7k
Activity
Jan ’22