Wednesday, October 28, 2026
HomeiOS Developmentios - Utilizing components output as variable

ios – Utilizing components output as variable

[ad_1]

I am attempting to take the next HStack:

HStack {
  Textual content("BUN/Creatinine Ratio")
  Spacer()
  Textual content("((coredata.one / coredata.two), specifier: "%.0f")")
}

And apply the next if…then assertion to it:

if let numberValue = Double(formulaOutput) { //Output from the above components.
  if (10...20) ~= numberValue {
    Picture(systemName: "checkmark.circle.fill")
        .foregroundColor(Colour(UIColor.systemGreen))
  }
  else {
    Picture(systemName: "exclamationmark.circle.fill")
        .foregroundColor(Colour(UIColor.systemRed))
  }
}

I simply can’t determine use the output as a variable. Additionally, is it doable to outline a couple of vary for the “else” assertion? <10 = Worth 1, >20 = Worth 2?

Thanks!

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments