Post

Replies

Boosts

Views

Activity

Reply to QR Code Image Recognition iOS 15 Bug
If a code once worked in older iOS might generate no data in iOS 15, it's worth sending a bug report to Apple. You should better include the project and the sample image to reproduce the issue. If you want to research what is happening with other developers, please show all the code and share the sample image. By the way, the session 10002 of WWDC21 has nothing to do with your issue. Using the right tag would help getting better responses.
Topic: Media Technologies SubTopic: General Tags:
Oct ’21
Reply to How to understand the type conversion in Int + Double?
I don’t understand why the last two lines are taken as compile error. Can anyone help to explain a bit? You may need to know two things. In Swift, addition of Int and Double is not allowed. (The binary operator + is not defined for (Int, Double) nor (Double, Int).) In Swift, the types of literals are defined depending on the context. In your first example: 3 + 0.14 // allowed 3 is interpreted as Double (this may not be as you expect), 0.14 is interpreted as Double. The integer literal 3 can be interpreted both as Int and as Double depending on the context. In this declaration: let three = 3 The type of three is inferred as Int, as there is not type hint in the declaration. And the type of rest is inferred as Double. In the following line, 3 is inferred as Double again in this context. 3 + rest // allowed Thus, the last two lines causes error: 0.14 + three // compile error three + 0.14 // compile error Because type inference of three is finished here and it has the fixed type Int.
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’21
Reply to Interface builder not setting button title?
It is a known issue that Apple Pie thing does not work well with Xcode 13. (It is very easily reproducible with creating a brand new project in Xcode 13.) These are some example threads: Guided Project: Apple Pie Apple Pie Guided Project: getting error - Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value.
Oct ’21
Reply to CLGeocoder Segmentation fault: 11 swiftUI
i get error that says Segnentation fault: 11, Generally, stopping with Segmentation Fault 11 is caused by some bug of Swift compiler. (You should better send a bug report to bugs.swift.org .) And in most cases, you can avoid this sort of bugs by fixing some sort of bugs in your code. It depends on many things, but if all your hidden codes are as I expect, it should be something like this: CLGeocoder().reverseGeocodeLocation(CLLocation(latitude: self.parent.source.latitude, longitude: self.parent.source.longitude)){ (placemarks, error) in if let error = error { print(error) return } guard let placemarks = placemarks else { print("placemarks is nil") return } if let pm = placemarks.first { self.parent.userLocation = (pm.subThoroughfare ?? "") + (pm.thoroughfare ?? "") + (pm.locality ?? "") } } (When showing some code, please use the Code Block feature. And better make parentheses balanced.) Generally, you should better avoid using forced something (forced unwrapping !, forced casting as! and implicitly unwrapped Optional !) as far as you can. Please try the code above.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’21
Reply to SwiftUI slider step broken since iOS 15
Thanks for showing your code. (And sorry for this site malfunctioning again.) But if you could show enough code (the view type containing the VStack, what settings is, what Setting is...), more readers would be involved to investigate what is happening. Anyway, I could have confirmed the difference. This seems to be a bug of Slider in iOS 15. Have you sent a bug report to Apple? And unfortunately, I cannot find a simple workaround for this issue as for now.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’21