Display EDR content with Core Image, Metal, and SwiftUI

RSS for tag

Discuss the WWDC22 Session Display EDR content with Core Image, Metal, and SwiftUI

Posts under wwdc2022-10114 tag

4 Posts

Post

Replies

Boosts

Views

Activity

Accessible label for braille devices
Hello, I want to improve UX for users who uses braille devices. I am using accessibilityLabel in SwiftUI to show information for blind users but I want to give a better experience for braille users using special characters like a block in braille to draw simple figures. Those characters cannot be spoken by TextToSpeech and that is the reason that I need an alternative of accessibilityLabel only for braille devices. Is this possible in UIKit, AppKit or SwiftUI? I preffer using SwiftUI but I will use anything to get this. Thanks in advance
0
0
559
Apr ’23
Deleting all items in an array causes issues with the ForEach used to render the arrays items
I use Core Data with two entities: Set and Link. Both entities contain a UUID id. Sets can contain 1 or more Links and this is represented in a 1-many relationship When the user wants to delete ALL links, this code is called for link in learningSet.webLinksArray.reversed(){       container.viewContext.delete(link) } do{ try container.viewContext.save() } catch let error { print("Failure deleting all links  } Here is the view code that renders link if !learningSet.webLinksArray.isEmpty{ LazyVGrid(columns: columns, alignment: .center, spacing: 16, pinnedViews: []) { ForEach(learningSet.webLinksArray, id: \.id) { link in  RichWebLinkView(webLink: link)      } } } It all works, but I get the following error/warning in the console ForEach<Array, Optional, ModifiedContent<ModifiedContent<DeckMiniView, _FrameLayout>, _FlexFrameLayout>>: the ID nil occurs multiple times within the collection, this will give undefined results! LazyVGridLayout: the ID nil is used by multiple child views, this will give undefined results! It's unclear why the LazyVGrid is even being re-rendered when the weblinksArray is empty. Im guessing this is happening while the delete for loop is running and the array isn't fully empty. Any suggestions on how to fix this would be appreciated.
1
0
1k
Dec ’22
How To Declare Optional Parameter Function
I have a function like this @ViewBuilder   func addInfo(_ text: String, action: (() -> Void)?, addDivider: Bool = true, centerAlignment: Bool = false, isBold: Bool = false) -> some View {     VStack {       Text(text)         .fontWeight(isBold ? .bold : .regular)         .frame(maxWidth: .infinity, alignment: centerAlignment ? .center : .leading)         .padding([.leading, .trailing], 10)         .padding([.top, .bottom], 5)         .contentShape(Rectangle())         .onTapGesture {           if let action {             action()           }         }       if addDivider {         Divider()       }     }   } I do not understand why i get a compile error Expected type after '->' if i call the function like this addInfo("Sample", action: () -> Void {             }) The error points to Void. What is the correct way to do this? Please advise.
2
0
871
Dec ’22
Accessible label for braille devices
Hello, I want to improve UX for users who uses braille devices. I am using accessibilityLabel in SwiftUI to show information for blind users but I want to give a better experience for braille users using special characters like a block in braille to draw simple figures. Those characters cannot be spoken by TextToSpeech and that is the reason that I need an alternative of accessibilityLabel only for braille devices. Is this possible in UIKit, AppKit or SwiftUI? I preffer using SwiftUI but I will use anything to get this. Thanks in advance
Replies
0
Boosts
0
Views
559
Activity
Apr ’23
confirmation dialog
How to confirmation dialogue in button disable and color change swiftui ios 16?
Replies
3
Boosts
1
Views
985
Activity
Mar ’23
Deleting all items in an array causes issues with the ForEach used to render the arrays items
I use Core Data with two entities: Set and Link. Both entities contain a UUID id. Sets can contain 1 or more Links and this is represented in a 1-many relationship When the user wants to delete ALL links, this code is called for link in learningSet.webLinksArray.reversed(){       container.viewContext.delete(link) } do{ try container.viewContext.save() } catch let error { print("Failure deleting all links  } Here is the view code that renders link if !learningSet.webLinksArray.isEmpty{ LazyVGrid(columns: columns, alignment: .center, spacing: 16, pinnedViews: []) { ForEach(learningSet.webLinksArray, id: \.id) { link in  RichWebLinkView(webLink: link)      } } } It all works, but I get the following error/warning in the console ForEach<Array, Optional, ModifiedContent<ModifiedContent<DeckMiniView, _FrameLayout>, _FlexFrameLayout>>: the ID nil occurs multiple times within the collection, this will give undefined results! LazyVGridLayout: the ID nil is used by multiple child views, this will give undefined results! It's unclear why the LazyVGrid is even being re-rendered when the weblinksArray is empty. Im guessing this is happening while the delete for loop is running and the array isn't fully empty. Any suggestions on how to fix this would be appreciated.
Replies
1
Boosts
0
Views
1k
Activity
Dec ’22
How To Declare Optional Parameter Function
I have a function like this @ViewBuilder   func addInfo(_ text: String, action: (() -> Void)?, addDivider: Bool = true, centerAlignment: Bool = false, isBold: Bool = false) -> some View {     VStack {       Text(text)         .fontWeight(isBold ? .bold : .regular)         .frame(maxWidth: .infinity, alignment: centerAlignment ? .center : .leading)         .padding([.leading, .trailing], 10)         .padding([.top, .bottom], 5)         .contentShape(Rectangle())         .onTapGesture {           if let action {             action()           }         }       if addDivider {         Divider()       }     }   } I do not understand why i get a compile error Expected type after '->' if i call the function like this addInfo("Sample", action: () -> Void {             }) The error points to Void. What is the correct way to do this? Please advise.
Replies
2
Boosts
0
Views
871
Activity
Dec ’22