Post

Replies

Boosts

Views

Activity

Help with SwiftUI Binding function parameter.
I have the following function decleration: func validName<I:Hashable>(name: String, focusState: Binding<FocusState<I.Type>>, fieldToFocusNext: I.Type, fieldToFocusOnError: I.Type, showError: Binding<Bool> ) -> Bool { return true } I'm getting this error on the FocusState binding parameter: Type 'I.Type' does not conform to protocol 'Hashable' It sure seems I have declared it as a Hashable. What and I doing wrong?
1
0
640
Nov ’21
Trying to derive a class type = JSONDecoder from a string
I get a compiler error at the live below. I have tried other combinations as well. let decoder = JSONDecoder() if let className = transation.name, let newClass = Bundle.main.classNamed(className)  { let object = try decoder.decode(type(of: newClass.self), from: decompressedData)&#9;<==== Type of expression is ambiguous without more context } Or let object = try decoder.decode(newClass.self, from: decompressedData) <==== Type of expression is ambiguous without more context Is what I want to do possible?
2
0
305
Aug ’20
Creating a DynamicViewContent extension like onDelete()
When looking at how onDelete() or onMove() is implemented you find they are extensions of a DynamicViewContent. It would then make sense a developer could create their own DynamicViewContent function that a List or ForEach would respond to. Is there any guidance on if this is first possible, then any sample code out there to do an implementation?
0
0
279
Jul ’20
Move Edge Transition in SwiftUI not executing
I have a simple view with a VStack made of two Rectangles. I have a binding on openView. That binding, a bool, is changed and the body of the view is called and the two Rectangles fade away. They do not transition each in the direction I intend. What is wrong with this code? { @Binding var openView: Bool var body: some View { VStack { if openView == false { Rectangle() .edgesIgnoringSafeArea(.all) .foregroundColor(Color.red) .transition(.move(edge: .top)) Rectangle() .edgesIgnoringSafeArea(.all) .foregroundColor(Color.blue) .padding(.top, -8) .transition(.move(edge: .bottom)) } } } }
2
0
1.9k
Jul ’20
NSItemProvide.loadItem doesn't provide .mov for a livephoto
Hi All,I'm trying to handle a kUTTypeLivePhoto type in a share extension but NSItemProvide.loadItem doesn't provide a .mov type for a LivePhoto from the Photos app. I do get the following: "public.jpeg", "com.apple.live-photo", "public.heic".When I use loadItem for com.apple.live-photo the item returned from the completionHandler is nil. I do get the .jpeg.Why don't I get a .mov?
0
0
413
Jan ’20