Post

Replies

Boosts

Views

Activity

Reply to Identifiable ID
Both your JSON and code are not valid, you should better show the right things for readers not to be confused. Have you tried to make it a computed property? struct ProductModel: Identifiable, Codable, Hashable { var id: Int {productId} var productId: Int var name: String }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’21
Reply to Published Vars
Missing argument for parameter 'from' in call That happens when a proper initializer is not defined in ProductModel. If you cannot solve it by yourself, please show the definition of ProductModel.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’21
Reply to Swift can't find the Entity Core Data
I have downloaded your GitHub project and tried to build it, and showed Succeeded. Some classes (not structs) representing Core Data entity are generated dynamically. So, some errors might be shown until the classes are acknowledged by the editing support. You can try Building the project (Cmd+B) even when some errors are still shown.
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Reply to Code Example Does not work
As far as I tried, it compiles without any problems with Xcode 12.5.1 on Intel Mac mini (2018). So, it might be the M1 Mac only issue and you should better send a bug report soon. The official documentation of systemThickMaterial does not have any descriptions about unavailability on M1 Mac.
Aug ’21
Reply to Where does the swift student challenge
want to try for next year swift student challenge The details of Swift Student Challenge would change the next year. You can check the details of this year and keep an eye on the coming announcements for WWDC 22. News and Updates would be one place you should better watch. And if you have not yet enabled emails from Apple on your Developer Account, you should better enable it. Installing Developer app will bring you many news as fast as many other sources.
Aug ’21
Reply to Initializer 'init(_:)' requires that 'Villager' conform to 'StringProtocol'
Your code causes bunch of errors -- Cannot find type 'Villager' in scope, Expected '}' in struct or Failed to produce diagnostic for expression; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project. And if I fix one error, many other errors generated. Please show enough code which can reproduce the error Initializer 'init(_:)' requires that 'Villager' conform to 'StringProtocol'. Please do not forget to use Code Block when you show some code.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’21
Reply to Implementing a RandomNumberGenerator for testing
Seems the value generated by next() needs to be large enough in the current implementation of random(in:using:). (randomElement(using:) may very probably be using the similar method internally.) class MockRandomNumberGenerator: RandomNumberGenerator { var current: UInt64 = 0 func next() -> UInt64 { defer { current += 1 } return current &* (UInt64.max/10) } } The header doc says Each call to next() must produce a uniform and independent random value. You may need to generate seemingly uniform values to make future algorithms of random(in:using:) work as you expect.
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Reply to Identifiable ID
Both your JSON and code are not valid, you should better show the right things for readers not to be confused. Have you tried to make it a computed property? struct ProductModel: Identifiable, Codable, Hashable { var id: Int {productId} var productId: Int var name: String }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to How to draw UIBezierPath with different colors?
CATransaction.begin() and CATransaction.commit() should be paired. Have you tried using 4 pairs of CATransaction.begin() and CATransaction.commit() for each stroke? By the way, Vision does not seem to be the right tag for your question. You are not using Vision framework, are you?
Topic: Machine Learning & AI SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to ScrollViewReader's scrollTo may be broken on iOS 15
I am not sure if this is sort of a bug or not, but you can send a bug report when you find some code once was working does not run in the latest beta.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Published Vars
Missing argument for parameter 'from' in call That happens when a proper initializer is not defined in ProductModel. If you cannot solve it by yourself, please show the definition of ProductModel.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Cannot find 'SecondView' in scope in swiftui error NavigationView.
Where is the definition of SecondView? When you show your code, you should better show whole code together. Whether your code works or not depends on other parts of your code.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Editor placeholder in source file
Sometimes, Xcode might pick us some old errors and show them. Please try Clean Build Folder or restarting Xcode or restarting your mac and see what happens.
Replies
Boosts
Views
Activity
Aug ’21
Reply to looping picker
Apple's platforms do not support such looping picker. You can find some articles or repositories implementing pseudo infinite picker searching with "ios infinite picker".
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Swift can't find the Entity Core Data
I have downloaded your GitHub project and tried to build it, and showed Succeeded. Some classes (not structs) representing Core Data entity are generated dynamically. So, some errors might be shown until the classes are acknowledged by the editing support. You can try Building the project (Cmd+B) even when some errors are still shown.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Code Example Does not work
As far as I tried, it compiles without any problems with Xcode 12.5.1 on Intel Mac mini (2018). So, it might be the M1 Mac only issue and you should better send a bug report soon. The official documentation of systemThickMaterial does not have any descriptions about unavailability on M1 Mac.
Replies
Boosts
Views
Activity
Aug ’21
Reply to Core Bluetooth Characteristic Value mismatch between iOS and macOS
One possible interpretation is that the device is showing a different value only when connected to iOS device. What does that characteristic mean?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Can swift be more like this?
What do you mean by like this? As far as I see the code-like things in your post, Swift would never be like this, in my opinion.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Where does the swift student challenge
want to try for next year swift student challenge The details of Swift Student Challenge would change the next year. You can check the details of this year and keep an eye on the coming announcements for WWDC 22. News and Updates would be one place you should better watch. And if you have not yet enabled emails from Apple on your Developer Account, you should better enable it. Installing Developer app will bring you many news as fast as many other sources.
Replies
Boosts
Views
Activity
Aug ’21
Reply to Initializer 'init(_:)' requires that 'Villager' conform to 'StringProtocol'
Your code causes bunch of errors -- Cannot find type 'Villager' in scope, Expected '}' in struct or Failed to produce diagnostic for expression; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project. And if I fix one error, many other errors generated. Please show enough code which can reproduce the error Initializer 'init(_:)' requires that 'Villager' conform to 'StringProtocol'. Please do not forget to use Code Block when you show some code.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Implementing a RandomNumberGenerator for testing
Seems the value generated by next() needs to be large enough in the current implementation of random(in:using:). (randomElement(using:) may very probably be using the similar method internally.) class MockRandomNumberGenerator: RandomNumberGenerator { var current: UInt64 = 0 func next() -> UInt64 { defer { current += 1 } return current &* (UInt64.max/10) } } The header doc says Each call to next() must produce a uniform and independent random value. You may need to generate seemingly uniform values to make future algorithms of random(in:using:) work as you expect.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to How to scroll UICollectionView cell automatically according to the time of day
Can you clarify what you mean by even if the application is closed? When the application is closed, no collection view is shown so scroll automatically does not make sense.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21