Post

Replies

Boosts

Views

Activity

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 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 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 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 Missing Fundamental something
Your code contains something unclear: loadFromJSON, someFunction and the type having the method someFunction. And there is no sample data. So, we readers cannot test it and hard to say something sure. But some parts of your code are clearly bad to use CAShapeLayer. You create only one CAShapeLayer with this line let shapeLayer = CAShapeLayer(), but shapeLayer is not added as sublayer to any other layer in your code. And, if you want multiple shape layers having different color each, you need to create multiple shape layers. As already written, your code has many missing parts, so I have written a simplified example. Please try this: import AppKit class AnalysisViewController: NSViewController { @IBOutlet var analysisView: NSView! func genrateGraph() { for bar: (CGFloat, CGFloat, CGFloat, ClosedRange<CGFloat>) in [ (1.0, 0.0, 0.0, 0...100), (0.0, 1.0, 0.0, 100...200), (1.0, 1.0, 0.0, 200...300), (0.0, 0.0, 1.0, 300...400), (1.0, 0.0, 1.0, 400...500), (0.0, 1.0, 1.0, 500...600), (1.0, 1.0, 1.0, 600...700), ] { let color = CGColor(srgbRed: bar.0, green: bar.1, blue: bar.2, alpha: 1.0) let x = bar.3.lowerBound let width = bar.3.upperBound - bar.3.lowerBound // //Create `CAShapeLayer` for each color let layer = CAShapeLayer() analysisView.layer?.addSublayer(layer) let height: CGFloat = 320 let rect = CGRect(x: x, y: 0, width: width, height: height) print(rect) let path = CGMutablePath() path.addRect(rect) layer.path = path layer.fillColor = color } } override func viewDidLoad() { super.viewDidLoad() view.frame = CGRect(x: 0, y: 0, width: 840, height: 640) analysisView.wantsLayer = true analysisView.frame = CGRect(x: 0, y: 0, width: 840, height: 640) genrateGraph() } } If this code does show you a grey window, you need to check if you properly setup AnalysisViewController on your storyboard. By the way, To work with CAShapeLayer, using CGPath (including CGMutablePath) is the simpler way. CGPath (or CGMutablePath) does not have a method stroke() and you have no need to call it. (In fact, you cannot!)
Topic: Media Technologies SubTopic: Audio Tags:
Oct ’21
Reply to Format Decimal as string in Swift?
You may use a NumberFormatter: import Foundation let values = [ "25.1", "25", "25.4575", ].map{Decimal(string:$0)!} let formatter = NumberFormatter() formatter.maximumFractionDigits = 2 formatter.minimumFractionDigits = 0 formatter.currencyCode = "USD" formatter.numberStyle = .currency for value in values { let string = formatter.string(for: value) ?? "?" print(string) } Output: $25.1 $25 $25.46
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’21
Reply to NTPv4 feature request
You should better try the Feedback Assistant. It is not only for bug reporting, but you can use it for feature request.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to How to animate showing of View that is not residing within the same View using withAnimation
Can you show your current code? One more, you should better respond to the comments and answers to communicate better in the dev forums.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to XML Parser - resolveExternalEntityName : how to resolve an code 26 error
As far as I tried, XMLParser (NSXMLParser) did not work as you expect, even if implementing parser(_:resolveExternalEntityName:systemID:) and/or setting shouldResolveExternalEntities = true. You may need to work with libxml2 directly or find another library to parse XML including HTML entities such as rsquo.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
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.
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Require support for capturing IMEI of device
The dev forums is not the right page to write a feature request. You should better visit the Feedback Assistant and write feature requests there. But removing the functionality to access IMEI was intentional, it would never come to Apple's platforms again.
Replies
Boosts
Views
Activity
Oct ’21
Reply to Require support to capturing signal strength of cellular network
The dev forums is not the right page to write a feature request. You should better visit the Feedback Assistant and write feature requests there.
Replies
Boosts
Views
Activity
Oct ’21
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?
Replies
Boosts
Views
Activity
Oct ’21
Reply to iOS15 Setting Title Color on transparentBackground navigationBar Doesn't Work?
Can you share your solution? Writing the solution as Your Answer and marking it as SOLUTION would give benefits to readers.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’21
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:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Combine with UITableView
What do you think is better?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Missing Fundamental something
Your code contains something unclear: loadFromJSON, someFunction and the type having the method someFunction. And there is no sample data. So, we readers cannot test it and hard to say something sure. But some parts of your code are clearly bad to use CAShapeLayer. You create only one CAShapeLayer with this line let shapeLayer = CAShapeLayer(), but shapeLayer is not added as sublayer to any other layer in your code. And, if you want multiple shape layers having different color each, you need to create multiple shape layers. As already written, your code has many missing parts, so I have written a simplified example. Please try this: import AppKit class AnalysisViewController: NSViewController { @IBOutlet var analysisView: NSView! func genrateGraph() { for bar: (CGFloat, CGFloat, CGFloat, ClosedRange<CGFloat>) in [ (1.0, 0.0, 0.0, 0...100), (0.0, 1.0, 0.0, 100...200), (1.0, 1.0, 0.0, 200...300), (0.0, 0.0, 1.0, 300...400), (1.0, 0.0, 1.0, 400...500), (0.0, 1.0, 1.0, 500...600), (1.0, 1.0, 1.0, 600...700), ] { let color = CGColor(srgbRed: bar.0, green: bar.1, blue: bar.2, alpha: 1.0) let x = bar.3.lowerBound let width = bar.3.upperBound - bar.3.lowerBound // //Create `CAShapeLayer` for each color let layer = CAShapeLayer() analysisView.layer?.addSublayer(layer) let height: CGFloat = 320 let rect = CGRect(x: x, y: 0, width: width, height: height) print(rect) let path = CGMutablePath() path.addRect(rect) layer.path = path layer.fillColor = color } } override func viewDidLoad() { super.viewDidLoad() view.frame = CGRect(x: 0, y: 0, width: 840, height: 640) analysisView.wantsLayer = true analysisView.frame = CGRect(x: 0, y: 0, width: 840, height: 640) genrateGraph() } } If this code does show you a grey window, you need to check if you properly setup AnalysisViewController on your storyboard. By the way, To work with CAShapeLayer, using CGPath (including CGMutablePath) is the simpler way. CGPath (or CGMutablePath) does not have a method stroke() and you have no need to call it. (In fact, you cannot!)
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Axie Infinity Testflight invitation code
You should better contact to the author of the app directly. Nowhere in the developer site is the place to exchange invitation code for some specific apps.
Replies
Boosts
Views
Activity
Oct ’21
Reply to Not able to download an app from testflight.
It would occur whether the build is the last version or not. Log in to App Store Connect and open the TestFlight page of the app, and check the STATUS field of the last build.
Replies
Boosts
Views
Activity
Oct ’21
Reply to Format Decimal as string in Swift?
You may use a NumberFormatter: import Foundation let values = [ "25.1", "25", "25.4575", ].map{Decimal(string:$0)!} let formatter = NumberFormatter() formatter.maximumFractionDigits = 2 formatter.minimumFractionDigits = 0 formatter.currencyCode = "USD" formatter.numberStyle = .currency for value in values { let string = formatter.string(for: value) ?? "?" print(string) } Output: $25.1 $25 $25.46
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’21