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?
Post
Replies
Boosts
Views
Activity
I want the sidebar to show if a user launches my app in portrait mode on iPadOS. I using SwiftUI so I'm hoping there is an easy way to do that.
Is this possible?
Is there any example code to do this?
I'm using EditMode all over my iOS app and for the first time I tried compiling for MacOS.
I get "'EditMode' is unavailable in macOS" This is a huge problem because I use it all over my app.
How do I handle this on MacOS?
I get this error:
"'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release"
when I do a save on a number of core data objects I created from a .plist. (If that matters.) Very strange. I'm not using NSKeyedUnarchiveFromData anywhere in my code.
How do track down and fix this error?
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)	<==== 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?
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?
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))
}
}
}
}
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?