From 24e8b2a08c04795ffe208261c38151ad30b1873c Mon Sep 17 00:00:00 2001 From: Ethan Pippin Date: Thu, 15 Aug 2024 19:18:07 -0600 Subject: [PATCH] fix --- .../SettingsView/Components/UserProfileRow.swift | 15 ++++++++------- .../UserProfileSettingsView.swift | 14 +++++++++----- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Swiftfin/Views/SettingsView/SettingsView/Components/UserProfileRow.swift b/Swiftfin/Views/SettingsView/SettingsView/Components/UserProfileRow.swift index 2733a10b5..d8be7ef06 100644 --- a/Swiftfin/Views/SettingsView/SettingsView/Components/UserProfileRow.swift +++ b/Swiftfin/Views/SettingsView/SettingsView/Components/UserProfileRow.swift @@ -38,13 +38,14 @@ extension SettingsView { } label: { HStack { - // TODO: check properly with non-uniform images and look for workaround - // Note: for an unknown reason, using a non uniform aspect ratio will cause a - // "view origin is invalid" crash within SwiftUI - imageView - .aspectRatio(1, contentMode: .fill) - .clipShape(.circle) - .frame(width: 50, height: 50) + // `.aspectRatio(contentMode: .fill)` on `imageView` alone + // causes a crash on some iOS versions + ZStack { + imageView + } + .aspectRatio(1, contentMode: .fill) + .clipShape(.circle) + .frame(width: 50, height: 50) Text(userSession.user.username) .fontWeight(.semibold) diff --git a/Swiftfin/Views/SettingsView/UserProfileSettingsView/UserProfileSettingsView.swift b/Swiftfin/Views/SettingsView/UserProfileSettingsView/UserProfileSettingsView.swift index 96bdca0d6..c76042f41 100644 --- a/Swiftfin/Views/SettingsView/UserProfileSettingsView/UserProfileSettingsView.swift +++ b/Swiftfin/Views/SettingsView/UserProfileSettingsView/UserProfileSettingsView.swift @@ -56,11 +56,15 @@ struct UserProfileSettingsView: View { isPresentingProfileImageOptions = true } label: { ZStack(alignment: .bottomTrailing) { - imageView - .aspectRatio(contentMode: .fill) - .clipShape(.circle) - .frame(width: 150, height: 150) - .shadow(radius: 5) + // `.aspectRatio(contentMode: .fill)` on `imageView` alone + // causes a crash on some iOS versions + ZStack { + imageView + } + .aspectRatio(contentMode: .fill) + .clipShape(.circle) + .frame(width: 150, height: 150) + .shadow(radius: 5) Image(systemName: "pencil.circle.fill") .resizable()