Post

Replies

Boosts

Views

Activity

Reply to iOS 17 - TextField color does not changes with state is updated
Change the code to confirm that the issue affects TextField, but not Text. The code below change the Text color to red when 1 is entered, but not change the TextField color. struct ContentView: View { @State private var numberText = "" var color: Color { let result = (Int(numberText) ?? 0) <= 0 if result { return .black } return .red } var body: some View { VStack { TextField("Enter a number", text: $numberText) .font(.title) .foregroundStyle( color ) Text("Font color will turn red if number > 0") .foregroundStyle( color ) } .padding() } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’23
Reply to iOS 17 - TextField color does not changes with state is updated
@Claude31 the print output as I expected, the the TextField color does not update on iOS 17 simulator. Here is the output for input 0, 1, A: numberText Int nil result = true numberText 0 Int Optional(0) result = true numberText Int nil result = true numberText 1 Int Optional(1) result = false numberText Int nil result = true numberText A Int nil result = true
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’23
Reply to @Attribute 'unique' and complex keys
I tested define @Attribute(.unique) multiple times and seems not a correct solution: @Model final class Book { @Attribute(.unique) var title: String @Attribute(.unique) var author: String } I tried to insert books have some wried result: container.mainContext.insert(BooK(title: "book 1", author: "author 1")) try? container.mainContext.save() // 1 book inserted container.mainContext.insert(BooK(title: "book 1", author: "author 1")) try? container.mainContext.save() // 1 book inserted as expected container.mainContext.insert(BooK(title: "book 2", author: "author 1")) try? container.mainContext.save() // "book 2" replace "book 1", and 1 book is left.
Jun ’23
Reply to iOS 17 - TextField color does not changes with state is updated
Tested with iOS 18.1 and Xcode 16.1 beta and the issue still exists
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to Xcode 16.0 - sometimes preview "collapsed"
still reproducible after updated to Xcode 16 beta 4
Replies
Boosts
Views
Activity
Jul ’24
Reply to iOS 17 - TextField color does not changes with state is updated
tested with iOS 17.1 beta and the issue still exists
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to iOS 17 - TextField color does not changes with state is updated
Change the code to confirm that the issue affects TextField, but not Text. The code below change the Text color to red when 1 is entered, but not change the TextField color. struct ContentView: View { @State private var numberText = "" var color: Color { let result = (Int(numberText) ?? 0) <= 0 if result { return .black } return .red } var body: some View { VStack { TextField("Enter a number", text: $numberText) .font(.title) .foregroundStyle( color ) Text("Font color will turn red if number > 0") .foregroundStyle( color ) } .padding() } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to iOS 17 - TextField color does not changes with state is updated
@Claude31 the print output as I expected, the the TextField color does not update on iOS 17 simulator. Here is the output for input 0, 1, A: numberText Int nil result = true numberText 0 Int Optional(0) result = true numberText Int nil result = true numberText 1 Int Optional(1) result = false numberText Int nil result = true numberText A Int nil result = true
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to @Attribute 'unique' and complex keys
My workaround: create our own unique key with title and author: @Model final class Book { @Attribute(.unique) var titleAndAuthor: String var title: String var author: String init(title: String, author: String) { self.title = title self.author = author titleAndAuthor = self.title + self.author } }
Replies
Boosts
Views
Activity
Jun ’23
Reply to @Attribute 'unique' and complex keys
I have a similar question also, for now I would create and UUID instead of complex key, e.g.: @Attribute(.unique) var identifier: UUID
Replies
Boosts
Views
Activity
Jun ’23
Reply to @Attribute 'unique' and complex keys
I tested define @Attribute(.unique) multiple times and seems not a correct solution: @Model final class Book { @Attribute(.unique) var title: String @Attribute(.unique) var author: String } I tried to insert books have some wried result: container.mainContext.insert(BooK(title: "book 1", author: "author 1")) try? container.mainContext.save() // 1 book inserted container.mainContext.insert(BooK(title: "book 1", author: "author 1")) try? container.mainContext.save() // 1 book inserted as expected container.mainContext.insert(BooK(title: "book 2", author: "author 1")) try? container.mainContext.save() // "book 2" replace "book 1", and 1 book is left.
Replies
Boosts
Views
Activity
Jun ’23
Reply to Xcode Cloud builds failing intermittently with network issues
I got a random failure for Phrase SDK failed downloading 'https://github.com/phrase/ios-sdk/releases/download/4.0.1/PhraseSDK.xcframework.zip' which is required by binary target 'PhraseSDK': downloadError("Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made
Replies
Boosts
Views
Activity
Jul ’22