var testTwo: Double = 0
testDouble = 80
testTwo = 200
var testThree: Int = 0
testThree = Int(testTwo/testDouble)
var testDate: Date = .now
var dateComponent = DateComponents()
dateComponent.day = testThree
var newDate: Date = Calendar.current.date(byAdding: dateComponentwith a thread error , to: testDate)!
This code works in a playground. However, when I try to use it in Xcode for my app it fails with the following error:
Thread 1: Fatal error: Double value cannot be converted to Int because it is either infinite or NaN
I printed the value being converted to Int and it was not NAN or infinite.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello!
Can you tell me why UIImageWriteToSavedPhotosAlbum stopped working on Mac Catalyst?
This method used to save photos to the library. Now I get an error when trying to save with the same code that previously worked.
error NSError domain: "ALAssetsLibraryErrorDomain" - code: -1 0x0000000cb00b4810
So I’m writing a program, as a developer would - ‘with Xcode.’
Code produced an error.
The key values were swapped. The parameters suggested were ‘optional parameters variables.’
“var name: TYPE? = (default)”
var name0: TYPE
=============================
name0 = “super cool”
‘Name is not yet declared at this point
provided with
x - incorrect argument replace
ExampleStruct(name:”supercool”)
should be
x - incorrect argument replace
ExampleStruct(name0:”supercool”)
=============================
In swift, there is a procedural prioritization within the constructor calling process.
Application calls constructor.
Constructor provides constructor signature. Signature requires parameters & throws an error if the params are not in appropriate order. - “got it compiler; thank you, very much”
Typically, when this occurs, defaults will be suggested. Often the variable type. Ie String, Bool.
such as:
StructName(param1:Int64, param2:Bool)
(Recently, I have seen a decline in @Apple’s performance in many vectors.)
As stated before, the key value pairs were out of sequence. The optionals were suggested instead of the required parameters.
This leads me to believe that there is an order of operations in the calling procedure that is being mismanaged.
I.e. regular expression, matching with optional. This confuses these with [forced, required] parameters, and the mismanagement of ‘key: value’ pairs.
this is a superficial prognosis and would like to know if anyone has any insight as to why this may occur.
Could it be a configuration setting? Is it possibly the network I connected to bumped into something. Etc..
I appreciate any and all feedback.
Please take into consideration the Apple developer forum, guidelines before posting comments.
#dev_div