Skip to content

Commit 1f891ed

Browse files
committed
fixed iOS 18 sheet presentation issue and presenting in page formate
1 parent 7dd853e commit 1f891ed

File tree

5 files changed

+23
-0
lines changed

5 files changed

+23
-0
lines changed

GoInfoGame/GoInfoGame/Helpers/Extensions.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,16 @@ extension URLRequest {
215215
}
216216
}
217217
}
218+
219+
extension View {
220+
@ViewBuilder
221+
func applyPresentationSizingPage() -> some View {
222+
if #available(iOS 18.0, *) {
223+
self.presentationSizing(.page)
224+
} else {
225+
// No-op for older OS, letting the default sizing apply.
226+
// You can add a fallback here if needed, e.g., using detents.
227+
self
228+
}
229+
}
230+
}

GoInfoGame/GoInfoGame/UI/Map/MapView.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ struct MapView: View {
322322
.presentationDetents([.fraction(0.85)])
323323
.interactiveDismissDisabled()
324324
.presentationDragIndicator(.hidden)
325+
.applyPresentationSizingPage()
325326
}
326327
.sheet(isPresented: $viewModel.showSatellitePicker) {
327328
SatellitePickerSheet(
@@ -341,6 +342,7 @@ struct MapView: View {
341342
.background(Color(red: 248/255, green: 248/255, blue: 248/255))
342343
.presentationDetents([.fraction(0.36)])
343344
.presentationDragIndicator(.visible)
345+
.applyPresentationSizingPage()
344346
}
345347
.sheet(isPresented: $showUserSettingsSheet) {
346348
UserSettingsView(selectedWorkspace: selectedWorkspace.title, options: OptionModel.options, onNavigate: { navigate in
@@ -383,6 +385,7 @@ struct MapView: View {
383385
.presentationDetents([.fraction(0.36)])
384386
.interactiveDismissDisabled()
385387
.presentationDragIndicator(.hidden)
388+
.applyPresentationSizingPage()
386389
}
387390

388391

@@ -431,6 +434,7 @@ struct MapView: View {
431434
.shadow(radius: 5)
432435
.presentationDetents([.fraction(0.2)])
433436
.presentationDragIndicator(.visible)
437+
.applyPresentationSizingPage()
434438
}
435439
}
436440
.sheet(isPresented: $showCreateNoteSheet, content: {
@@ -446,6 +450,7 @@ struct MapView: View {
446450
})
447451
.presentationDetents([.fraction(0.6)])
448452
.presentationDragIndicator(.visible)
453+
.applyPresentationSizingPage()
449454

450455
})
451456
.sheet(isPresented: $showAddFeatureSheet) {
@@ -460,6 +465,7 @@ struct MapView: View {
460465
})
461466
.presentationDetents([.fraction(0.6)])
462467
.presentationDragIndicator(.visible)
468+
.applyPresentationSizingPage()
463469
}
464470

465471
.sheet(isPresented: $isPresented, content: {
@@ -472,6 +478,7 @@ struct MapView: View {
472478
.scrollDisabled(false)
473479
.interactiveDismissDisabled()
474480
.environmentObject(contextualInfo)
481+
.applyPresentationSizingPage()
475482

476483
})
477484
.onReceive(MapViewPublisher.shared.dismissSheet) { scenario in

GoInfoGame/GoInfoGame/UI/Profile/ProfileView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ struct LoginView: View {
205205
}
206206
.navigationBarHidden(false)
207207
.padding()
208+
.applyPresentationSizingPage()
208209
}
209210

210211
}

GoInfoGame/GoInfoGame/UI/Utils/FloatingActionButtonStack.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ struct FloatingActionButtonStack: View {
3434
.presentationDetents([.fraction(0.85)])
3535
.interactiveDismissDisabled()
3636
.presentationDragIndicator(.hidden)
37+
.applyPresentationSizingPage()
3738
}
3839
}
3940
.offset(x: -25, y: 10)

GoInfoGame/GoInfoGame/quests/LongQuests/View/LongForm.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ struct LongForm: View, QuestForm {
233233
}
234234
.sheet(isPresented: $isCameraPresented) {
235235
CameraView(capturedImage: $capturedImage, isPresented: $isCameraPresented)
236+
.applyPresentationSizingPage()
236237
}
237238
}
238239
.alert(self.submitAlert, isPresented: $showSubmitAlert) {

0 commit comments

Comments
 (0)