Post marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
Post marked as solved with 2 replies, 0 views
Hi Claude31,
Thanks for your response. I am new to SwiftUI programming. I am trying to display number of months with just writing few lines of code.
I did use,
"Text("The number of months are (Months)")"
as you suggested but, I get this error next to that code, "No exact matches in call to instance method 'appendInterpolation'"
I also tried applying the "wrappedValue" as you suggested, Text("($Months.wrappedValue)"), the error goes away, but, in the code one line above that where the Months var is referenced, I get another error as shown below:
let date = Date()
let dateDiff = Calendar.current.dateComponents([.month], from: PurchaseDate, to: date)
let Months = dateDiff.month (error message here, "Initialization of immutable value 'Months' was never used; consider replacing with assignment to '_' or removing it")
Text("The number of months are ($Months.wrappedValue)") (no error message after applying the wrappedValue)
I will review the link for the stack overflow and see it helps fixing this code.
Thanks