Post

Replies

Boosts

Views

Activity

Reply to Does SwiftUI List reuse its cells?
SwiftUI lists are lazy loaded: so they load when you scroll. See discussion here: https://forums.developer.apple.com/forums/thread/651256 And yes, cells are reused. Could you show the code ? If data contains thumbnail and HD, it is normal that both are loaded. What did you expect ? What do you want ? Could you create another State var, with only thumbnail, and show HD only when tapping the thumbnail ? It all depends on your spec.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’24
Reply to Programmatic UICollectionViewController
Have you searched for tutorials ? Some here: https://medium.com/@thenoobdev10/programmatic-uicollectionviewcontroller-tutorial-925f009c98a7 They explain how to create a property for layout and initialize collectionViewController with flowLayout. Update in AppDelegate
Topic: UI Frameworks SubTopic: UIKit
Jul ’24
Reply to SwiftUI @State vs @Binding vs @Bindable in ParentView and ChildView
What are the differences between @State, @Binding They both refer to state var in the View. But @State var "belongs" to the view @Binding var "belongs" to another view, that means there is another State var in the other view that share the same pointer. So when you change var in the other view, it is also changed in the first. There are many tutorials to explain, like these ones: https://www.hackingwithswift.com/quick-start/swiftui/what-is-the-binding-property-wrapper https://www.hackingwithswift.com/quick-start/swiftdata/whats-the-difference-between-bindable-and-binding
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’24
Reply to App Rejeitado - Descrição do bug: uma tela em branco foi exibida na inicialização
Do you observe the problem yourself ? Is it UIKit or SwiftUI ? A possible reason is that you have some code in appDelegate that takes too long (for instance because of betwork access). You should move this code out of appDelegate. Observa o problema pessoalmente? É o UIKit ou o SwiftUI? Uma possível razão é o facto de ter algum código na appDelegate que demora demasiado tempo (por exemplo, devido ao acesso ao betwork). Deveria retirar esse código da appDelegate. Podes mostrar o teu código appDelegate?
Jul ’24
Reply to [SwiftUI] When to use closures vs equals for variable assignment?
It is not a convention, it is a major difference. The difference is that computed var (first option) is evaluated each time the var is accessed. So it can change on the fly. The second option is initialised once for all. Consider the simple case: var myVar: Int { (0...10).randomElement()! } var myVar2 = (0...10).randomElement()! for _ in 0...3 { print(myVar, myVar2) } You get: 5 4 1 4 4 4 7 4
Jul ’24
Reply to Incorrect JSON Format with JSONEncoder
print(encoded) returns 110 bytes. When I test it with the following code, let account = AccountCreationData(name: "name", email: "email", phone: "phone", password: "password") if let encoded = try? JSONEncoder().encode(account) { print("encoded", encoded) print("content", String(data: encoded, encoding: .utf8)!) // To see the content of encoding } else { print("Failed to encode request") } I get encoded 69 bytes // (the string 'name: "name", email: "email", phone: "phone", password: "password"' is 66 bytes) content {"email":"email","password":"password","name":"name","phone":"phone"} Could you print the same log on your side ? And please show how you call createAccount. You may have a problem there. Also, why do you dispatch here: DispatchQueue.main.async { completion(resData) } } catch let jsonError as NSError {
Topic: App & System Services SubTopic: General Tags:
Jul ’24
Reply to Does SwiftUI List reuse its cells?
SwiftUI lists are lazy loaded: so they load when you scroll. See discussion here: https://forums.developer.apple.com/forums/thread/651256 And yes, cells are reused. Could you show the code ? If data contains thumbnail and HD, it is normal that both are loaded. What did you expect ? What do you want ? Could you create another State var, with only thumbnail, and show HD only when tapping the thumbnail ? It all depends on your spec.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to Programmatic UICollectionViewController
Another interesting reference: https://www.appsdeveloperblog.com/create-uicollectionview-programmatically-in-swift/
Topic: UI Frameworks SubTopic: UIKit
Replies
Boosts
Views
Activity
Jul ’24
Reply to How to obtain photos and where are they saved from?
Are you looking for the location where the photo was shot ? It is location property in PHAsset: https://developer.apple.com/documentation/photokit/phasset Some sample code to access here: ttps://mobikul.com/phasset-in-swift/ Hope that helps.
Replies
Boosts
Views
Activity
Jul ’24
Reply to Programmatic UICollectionViewController
Have you searched for tutorials ? Some here: https://medium.com/@thenoobdev10/programmatic-uicollectionviewcontroller-tutorial-925f009c98a7 They explain how to create a property for layout and initialize collectionViewController with flowLayout. Update in AppDelegate
Topic: UI Frameworks SubTopic: UIKit
Replies
Boosts
Views
Activity
Jul ’24
Reply to Make Developer Forums Better!
You should file a bug report. When you search, you can select the order: Most relevant, last updated… Doesn't it help ?
Replies
Boosts
Views
Activity
Jul ’24
Reply to Duplicated entries in developer.apple.com/account/resources/certificates/list
Have you checked the dates of the certificates ? Is one of the duplicates greyed out ? IMHO, it should be no problem (unless you have another underlying problem in the system configuration). Only the valid one is used.
Replies
Boosts
Views
Activity
Jul ’24
Reply to SwiftUI @State vs @Binding vs @Bindable in ParentView and ChildView
What are the differences between @State, @Binding They both refer to state var in the View. But @State var "belongs" to the view @Binding var "belongs" to another view, that means there is another State var in the other view that share the same pointer. So when you change var in the other view, it is also changed in the first. There are many tutorials to explain, like these ones: https://www.hackingwithswift.com/quick-start/swiftui/what-is-the-binding-property-wrapper https://www.hackingwithswift.com/quick-start/swiftdata/whats-the-difference-between-bindable-and-binding
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to App Rejeitado - Descrição do bug: uma tela em branco foi exibida na inicialização
Do you observe the problem yourself ? Is it UIKit or SwiftUI ? A possible reason is that you have some code in appDelegate that takes too long (for instance because of betwork access). You should move this code out of appDelegate. Observa o problema pessoalmente? É o UIKit ou o SwiftUI? Uma possível razão é o facto de ter algum código na appDelegate que demora demasiado tempo (por exemplo, devido ao acesso ao betwork). Deveria retirar esse código da appDelegate. Podes mostrar o teu código appDelegate?
Replies
Boosts
Views
Activity
Jul ’24
Reply to [SwiftUI] When to use closures vs equals for variable assignment?
It is not a convention, it is a major difference. The difference is that computed var (first option) is evaluated each time the var is accessed. So it can change on the fly. The second option is initialised once for all. Consider the simple case: var myVar: Int { (0...10).randomElement()! } var myVar2 = (0...10).randomElement()! for _ in 0...3 { print(myVar, myVar2) } You get: 5 4 1 4 4 4 7 4
Replies
Boosts
Views
Activity
Jul ’24
Reply to iPhone mirroring accessibility feature needed
You should file a suggestion in the feedback assistant. Have you tried to use the keyboard vuzualizer on the Mac ? That should provide most of what you are looking for, without occupying space on the iPhone mirrored screen. Best of both.
Replies
Boosts
Views
Activity
Jul ’24
Reply to SwiftUI preview with different @AppStorage values
@Jackson-G has provided an interesting answer. But why do you want to do it in Preview and not in simulator. At the risk of pushing preview beyond its limits.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to Will this app's plan pass the review?
You have to check guideline 1.1.4 on Objectionable Content. You should probably indicate in the comments (if that's the case), that all the cafes you reference have signed a code of conduit and hence you meet this guideline.
Replies
Boosts
Views
Activity
Jul ’24
Reply to 4.1.0 Guideline documentation
IMHO, an agreement between you and the company, certified by a notary should be enough.
Replies
Boosts
Views
Activity
Jul ’24
Reply to Incorrect JSON Format with JSONEncoder
print(encoded) returns 110 bytes. When I test it with the following code, let account = AccountCreationData(name: "name", email: "email", phone: "phone", password: "password") if let encoded = try? JSONEncoder().encode(account) { print("encoded", encoded) print("content", String(data: encoded, encoding: .utf8)!) // To see the content of encoding } else { print("Failed to encode request") } I get encoded 69 bytes // (the string 'name: "name", email: "email", phone: "phone", password: "password"' is 66 bytes) content {"email":"email","password":"password","name":"name","phone":"phone"} Could you print the same log on your side ? And please show how you call createAccount. You may have a problem there. Also, why do you dispatch here: DispatchQueue.main.async { completion(resData) } } catch let jsonError as NSError {
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to Incorrect JSON Format with JSONEncoder
Could you show how you defined account (its content) ? And print a log and report what you get: guard let encoded = try? JSONEncoder().encode(account) else { print("Failed to encode request") return } request.httpBody = encoded print("encoded", encoded)
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’24