Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DebuggingAndProfiling.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"DebuggingAndProfiling/Preview Content\"";
DEVELOPMENT_TEAM = 3ZQJ35HR4K;
DEVELOPMENT_TEAM = 2N3K33KLKM;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
Expand Down Expand Up @@ -462,7 +462,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"DebuggingAndProfiling/Preview Content\"";
DEVELOPMENT_TEAM = 3ZQJ35HR4K;
DEVELOPMENT_TEAM = 2N3K33KLKM;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
Expand Down
11 changes: 11 additions & 0 deletions DebuggingAndProfiling/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,14 @@ struct ContentView_Previews: PreviewProvider {
ContentView()
}
}

// Calculating temp was using the wrong type being var instead of let. Also its calulations was wrong.

//Original -> var cel = (fah + 32) * 5 / 9
//Correct -> let cel = (fah - 32) * 5 / 9
//Original -> var fah = (cel * 5 / 9 ) + 32
//Correct -> let fah = (cel * 9 / 5) + 32

//2. Foreground in OccassionalUpdate was redrawn 7 times and stress test continues to grow while in foreground

//3. OccasionalUpdate takes awhile after button click. However Stress test runtime is about a quarter of the time.
4 changes: 2 additions & 2 deletions DebuggingAndProfiling/DebugThisCode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct DebugThisCode: View {
print("Fah changed to \(fahrenheitTemp)")
if let fah = Double(fahrenheitTemp) {
print("Value is \(fah)")
var cel = (fah + 32) * 5 / 9
let cel = (fah - 32) * 5 / 9
celsiusTemp = String(cel)
} else {
print("Not a valid number")
Expand All @@ -42,7 +42,7 @@ struct DebugThisCode: View {
TextField("Temperature in Celsius", text: $celsiusTemp)
Button(action: {
if let cel = Double(celsiusTemp) {
var fah = (cel * 5 / 9 ) + 32
let fah = (cel * 5 / 9 ) + 32
fahrenheitTemp = String(fah)
} else {
print("Not a valid number")
Expand Down