Post

Replies

Boosts

Views

Activity

Reply to Weak references
I believe weak references are not required when using self inside the dispatch queues. I do not understand what you mean. There may be many cases you should use weak even when using self inside the dispatch queues.
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Reply to How should I learn Swift?
One thing you should know is that there is not the best for everyone. You should better spend some time and try as much resource as you can touch. Some Apple's resource would be a good starting point, but it is not clear if it would be the best for you. And forget about Roblox LuaU, experiences of other languages may not always get things better when learning a new language.
Aug ’21
Reply to Text - Formatted HTML
Is there a way to use Text directly, but keeping break lines and lists? Can you show some examples of some formatted text? Generally, Text is not intended to show HTML content. Using the new feature AttributedString of iOS 15, you may be able to show some limited sets of HTML as formatted text, but depends on the actual contents you want to show.
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 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 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 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 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