Post

Replies

Boosts

Views

Activity

Reply to Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
Please post code here as formatted text, not screenshots. Would be easy to copy the code and test myself, but no one will try to write that code to try out what is the issue. Also, post the error also as text, we cannot see from the picture what the error is. Is that a compiler error or runtime error? Compiler doesn't check the URL for correctness so if the URL is incorrect, that would be a runtime error then?
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’23
Reply to When to use private?
This is a basic object oriented design/programming thing. Related to design principles of information hiding, encapsulation and modular design. The idea is to hide all implementation details in the class/struct and only expose minimal public interface to other elements in the software. Apparently the var members of the struct are used from other structs/classes in the same package, but the private function should be used only by the GameView struct.
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’23
Reply to Fatal error: Duplicate keys of type 'SOMETYPE' were found in a Dictionary.
With this change I got it working without the error. func updateVorlesung(oldID : UUID?, newV : Vorlesung) { if let oldID { if let vorlesung = vorlesungen.first(where: { $0.vID == oldID}) { vorlesung.day = newV.day } } else { self.vorlesungen.append(newV) } self.objectWillChange.send() // self.vorlesungen.removeAll { value in // value.vID == oldID // } // self.vorlesungen.append(newV) } Though here you do not actually need to create a new Vorlesung if the object already exists in the container, just pass the new/changed weekday as the second parameter to the method. Check out what works for you. Whether this fits in your overall design is another matter :)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’23
Reply to converting from Objective-C to Swift
One possibility is to use... tcpStreamTask = URLSession.shared.streamTask(withHostName: host, port: port) tcpStreamTask?.resume() while running { let result = try await tcpStreamTask?.readData(ofMinLength: 10, maxLength: 8096, timeout: 0) ... let toSend = dataString.data(using: .utf8)! try await tcpStreamTask?.write(toSend, timeout: 0) ... ...the URLSessionStreamTask, the example above is with async code but can do with closures too. If that is something you can do.
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’23
Reply to Azure Database for xcode
I guess you meant that you want to develop an app, using Xcode and Swift (?) programming language that connects to and uses Microsoft Azure databases? If yes, here is a step for you: https://github.com/Azure/azure-sdk-for-ios There might be other steps elsewhere, if you do some (more) searching.
Feb ’23
Reply to Open a simple directory in XCode
If you want to just view the code, open them from the terminal: open *.* or open *.h for header files, open *.c for C files, etc. Assuming Xcode is the default app for opening these files in your system. Alternatively, create an empty C/C++ project and then add the files to it. If the code files include a cmake (https://cmake.org) project file CMakeLists.txt, then you can easily create an Xcode project from it: mkdir xcode && cd xcode cmake -GXcode .. And then open the generated Xcode project file.
Jan ’23
Reply to WeatherKit Apple Weather trademark and legal link.
Another wonderer here. I am building an independent Apple Watch app without iOS counterpart app. When adding the link to the app view, and tapping it on simulator, this error is seen in the logs: Attempting to open url https://weather-data.apple.com/legal-attribution.html with scheme https failed: Error Domain=NSPOSIXErrorDomain Code=45 "Operation not supported" UserInfo={_LSLine So is it even possible to offer this link in watchOS app or is this working on a read device? Currently cannot test this on a real watch with beta software.
Topic: App & System Services SubTopic: General Tags:
Aug ’22
Reply to Open source published apps?
I would remove your DEVELOPMENT_TEAM id from the xcodeproj file and put them to xcconfig file. Then in your project file, specify DEVELOPMENT_TEAM = "$(inherited)"; Other devs forking/cloning your project would then specify their dev team id in their xcconfig file. See https://help.apple.com/xcode/mac/11.4/#/dev745c5c974 for more information.
Feb ’21