Post

Replies

Boosts

Views

Activity

Comment on focused modifier
In the previous solution, I made a mistake: if I want to have TextFieldInError being working with other view, I can't link it with LoginFocusable, but I have to make a Generic: struct TextFieldWithError<T: Hashable>: View { var label: String @Binding var text: String @Binding var textError: String var focusId: T? @FocusState.Binding var focus: T? }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’23
Comment on programmatic constraints and Interface Builder
I wanted to simplify my problem, that's why I put the constraints in the subclass (lass Container) It is exactly the same if I put the constraints in the code of the ViewController I think the problem is that Interface Builder doesn't apply constraints. If I add the following method: func setupIBConstraints() {         if (superview?.frame.size.width)! < (superview?.frame.size.height)! {             label.text = "setupIBConstraints(.CR \(superview?.frame.size.width)"             label.sizeToFit() self.layer.frame = CGRect(x: 30, y: 100, width: (superview?.frame.size.width ?? 0)-60, height: (superview?.frame.size.height ?? 0)-300)         } else {             label.text = "setupIBConstraints(.CC ou .RC \(superview?.frame.size.width)"             label.sizeToFit()             self.layer.frame = CGRect(x: 20, y: 50, width: (superview?.frame.size.width ?? 0)-100, height: (superview?.frame.size.height ?? 0)-100)         }     } and in method layoutSubviews() I replace setupConstraints(theOrientation) by #if TARGET_INTERFACE_BUILDER        setupIBConstraints()  #else        setupConstraints(theOrientation)  #endif I can see a correct result in Interface Builder it proves that code is well executed by Interface Builder change of frame is OK for IB but it doesn't apply constraints I would reformulate my question: how to apply programmatic constraints in IB Of course, I can write constraints in IB but I thought it was possible by program and see the results in IB
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Comment on focused modifier
In the previous solution, I made a mistake: if I want to have TextFieldInError being working with other view, I can't link it with LoginFocusable, but I have to make a Generic: struct TextFieldWithError<T: Hashable>: View { var label: String @Binding var text: String @Binding var textError: String var focusId: T? @FocusState.Binding var focus: T? }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Comment on focused modifier
yes, it is not accepted
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Comment on Compiler problem
That what I followed to build my share extension
Replies
Boosts
Views
Activity
Dec ’22
Comment on scrollview layout
Thank's Claude
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’22
Comment on async await invalid conversion from throwing function
You're right, resignFirstesponder is not async, but I think that await withCheckedThrowingContinuation resolve the problem of non async functions calling async ones
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’22
Comment on swift and AppDirectory
Yes my App is sandboxes, and permission is OK in the signing capabilities of the App (I will read the link you posted)
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Comment on swift and AppDirectory
My code is let dialogURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first print(dialogURL) and the result is Optional(file:///Users/patricerapaport/Library/Containers/PR.medical/Data/Documents/)
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Comment on programmatic constraints and Interface Builder
I wanted to simplify my problem, that's why I put the constraints in the subclass (lass Container) It is exactly the same if I put the constraints in the code of the ViewController I think the problem is that Interface Builder doesn't apply constraints. If I add the following method: func setupIBConstraints() {         if (superview?.frame.size.width)! < (superview?.frame.size.height)! {             label.text = "setupIBConstraints(.CR \(superview?.frame.size.width)"             label.sizeToFit() self.layer.frame = CGRect(x: 30, y: 100, width: (superview?.frame.size.width ?? 0)-60, height: (superview?.frame.size.height ?? 0)-300)         } else {             label.text = "setupIBConstraints(.CC ou .RC \(superview?.frame.size.width)"             label.sizeToFit()             self.layer.frame = CGRect(x: 20, y: 50, width: (superview?.frame.size.width ?? 0)-100, height: (superview?.frame.size.height ?? 0)-100)         }     } and in method layoutSubviews() I replace setupConstraints(theOrientation) by #if TARGET_INTERFACE_BUILDER        setupIBConstraints()  #else        setupConstraints(theOrientation)  #endif I can see a correct result in Interface Builder it proves that code is well executed by Interface Builder change of frame is OK for IB but it doesn't apply constraints I would reformulate my question: how to apply programmatic constraints in IB Of course, I can write constraints in IB but I thought it was possible by program and see the results in IB
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21