diff --git a/DebuggingAndProfiling/ContentView.swift b/DebuggingAndProfiling/ContentView.swift index f931a6d..2fc40c4 100644 --- a/DebuggingAndProfiling/ContentView.swift +++ b/DebuggingAndProfiling/ContentView.swift @@ -35,3 +35,15 @@ struct ContentView_Previews: PreviewProvider { ContentView() } } + + + +// Converting f to c required a variable change from var to let. + +//OG - var cel = (fah + 32) * 5 / 9 +//NEW - let cel = (fah - 32) * 5 / 9 +//OG - var fah = (cel * 5 / 9 ) + 32 +//NEW - let fah = (cel * 9 / 5) + 32 +//2. Foreground in OccassionalUpdate redrawn 7 times, Stress test continues to grow while in foreground +//3. //OccasionalUpdate shows a hang after button click, Stress test runtime is about 28ms per run + diff --git a/DebuggingAndProfiling/DebugThisCode.swift b/DebuggingAndProfiling/DebugThisCode.swift index 647fc57..6afc09f 100644 --- a/DebuggingAndProfiling/DebugThisCode.swift +++ b/DebuggingAndProfiling/DebugThisCode.swift @@ -22,7 +22,10 @@ struct DebugThisCode: View { print("Fah changed to \(fahrenheitTemp)") if let fah = Double(fahrenheitTemp) { print("Value is \(fah)") - var cel = (fah + 32) * 5 / 9 + + //Variable 'cel' was never mutated; consider changing to 'let' constant + + let cel = (fah + 32) * 5 / 9 celsiusTemp = String(cel) } else { print("Not a valid number") @@ -42,7 +45,8 @@ struct DebugThisCode: View { TextField("Temperature in Celsius", text: $celsiusTemp) Button(action: { if let cel = Double(celsiusTemp) { - var fah = (cel * 5 / 9 ) + 32 + // Variable 'fah' was never mutated; consider changing to 'let' constant + let fah = (cel * 5 / 9 ) + 32 fahrenheitTemp = String(fah) } else { print("Not a valid number")