Post

Replies

Boosts

Views

Activity

Reply to Debug Menu Grayed Out
I'm running High Sierra 10.13.6 (that's the highest OS my computer will go to b/c it's a late 2011 pro). When I looked up what version of Xcode to get, I saw I needed to get Version 9.4.1 (9F2000) so that's what version of Xcode I have. As far as I checked, you can run Xcode 10 or Xcode 10.1 on a Mac running 10.13.6 . But if Xcode 9.4.1 is doing well with your C++ class, it would not make a big difference. I'm wondering if there's anything I can do to make it work ? What sort of debugging feature do you want to use? If you want to use some feature which are runtime-only, run your code. And you may need to learn that some of the features in the Debug menu are only for apps and you would not make them use in C++ code. So, again, what in the Debug menu do you want to use?
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