Dear Community,
I have a use case where I have to present multiple sheets of different, non-resizable heights from a View.
It seems like when multiple .presentationDetents() are specified and you control the current detent with selection:, SwiftUI always allows the user to resize the sheet, even if .presentationDragIndicator(.hidden) is set.
In my use case, however, I wouldn't like to let the user do so, because this would result in a small view presented on a large sheet with lot of empty space around.
Specifying just one presentationDetent and changing it or its height programmatically doesn't seem to work: the change does not reflect immediately, even if the view in the sheet is given a new id() every time.
The only thing I could come up with is a custom detent as follows:
import SwiftUI
public class DynamicDetent: CustomPresentationDetent {
static var height: CGFloat = 80
public static func height(in context: Context) -> CGFloat? {
return height
}
}
extension PresentationDetent {
static let dynamic = Self.custom(DynamicDetent.self)
}
As the height() functon is being called every time the sheet is being displayed, setting DynamicDetent.height before displaying a new sheet works. Is there any other, less hacky way to achieve the same result?
Post
Replies
Boosts
Views
Activity
Dear Community,
I have paired a new iPhone 15 Pro with XCode, enabled Developer Mode, and have tried launching multiple applications on it. No matter what I run, the application quits immediately and I always get the same error:
The request to open "BUNDLE_ID" failed.
Domain: IDELaunchCoreDevice
Code: 0
User Info: {
DVTErrorCreationDateKey = "2024-04-07 00:07:20 +0000";
IDERunOperationFailingWorker = IDELaunchCoreDeviceWorker;
}
--
The request to open "BUNDLE_ID" failed.
Domain: IDELaunchCoreDevice
Code: 0
User Info: {
IDERunOperationFailingWorker = IDELaunchCoreDeviceWorker;
}
--
The application failed to launch.
Domain: com.apple.dt.CoreDeviceError
Code: 10002
User Info: {
BundleIdentifier = "BUNDLE_ID";
}
--
The request to open "BUNDLE_ID" failed.
Domain: FBSOpenApplicationServiceErrorDomain
Code: 1
Failure Reason: The request was denied by service delegate (SBMainWorkspace).
User Info: {
BSErrorCodeDescription = RequestDenied;
FBSOpenApplicationRequestID = 0x5841;
}
--
The operation couldn’t be completed. The process failed to launch.
Domain: FBProcessExit
Code: 64
Failure Reason: The process failed to launch.
User Info: {
BSErrorCodeDescription = "launch-failed";
}
--
The operation couldn’t be completed. Launch failed.
Domain: RBSRequestErrorDomain
Code: 5
Failure Reason: Launch failed.
--
Launchd job spawn failed
Domain: NSPOSIXErrorDomain
Code: 85
Failure Reason: Bad executable (or shared library)
--
Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : {
"device_isCoreDevice" = 1;
"device_model" = "iPhone16,1";
"device_osBuild" = "17.4.1 (21E236)";
"device_platform" = "com.apple.platform.iphoneos";
"dvt_coredevice_version" = "355.24";
"dvt_mobiledevice_version" = "1643.100.58";
"launchSession_schemeCommand" = Run;
"launchSession_state" = 1;
"launchSession_targetArch" = arm64;
"operation_duration_ms" = 802;
"operation_errorCode" = 0;
"operation_errorDomain" = IDELaunchCoreDevice;
"operation_errorWorker" = IDELaunchCoreDeviceWorker;
"operation_name" = IDERunOperationWorkerGroup;
"param_debugger_attachToExtensions" = 0;
"param_debugger_attachToXPC" = 1;
"param_debugger_type" = 3;
"param_destination_isProxy" = 0;
"param_destination_platform" = "com.apple.platform.iphoneos";
"param_diag_MainThreadChecker_stopOnIssue" = 0;
"param_diag_MallocStackLogging_enableDuringAttach" = 0;
"param_diag_MallocStackLogging_enableForXPC" = 1;
"param_diag_allowLocationSimulation" = 1;
"param_diag_checker_tpc_enable" = 1;
"param_diag_gpu_frameCapture_enable" = 0;
"param_diag_gpu_shaderValidation_enable" = 0;
"param_diag_gpu_validation_enable" = 0;
"param_diag_memoryGraphOnResourceException" = 0;
"param_diag_queueDebugging_enable" = 1;
"param_diag_runtimeProfile_generate" = 0;
"param_diag_sanitizer_asan_enable" = 0;
"param_diag_sanitizer_tsan_enable" = 0;
"param_diag_sanitizer_tsan_stopOnIssue" = 0;
"param_diag_sanitizer_ubsan_stopOnIssue" = 0;
"param_diag_showNonLocalizedStrings" = 0;
"param_diag_viewDebugging_enabled" = 1;
"param_diag_viewDebugging_insertDylibOnLaunch" = 1;
"param_install_style" = 0;
"param_launcher_UID" = 2;
"param_launcher_allowDeviceSensorReplayData" = 0;
"param_launcher_kind" = 0;
"param_launcher_style" = 99;
"param_launcher_substyle" = 8192;
"param_runnable_appExtensionHostRunMode" = 0;
"param_runnable_productType" = "com.apple.product-type.application";
"param_structuredConsoleMode" = 1;
"param_testing_launchedForTesting" = 0;
"param_testing_suppressSimulatorApp" = 0;
"param_testing_usingCLI" = 0;
"sdk_canonicalName" = "iphoneos17.4";
"sdk_osVersion" = "17.4";
"sdk_variant" = iphoneos;
}
--
System Information
macOS Version 14.4.1 (Build 23E224)
Xcode 15.3 (22618) (Build 15E204a)
Timestamp: 2024-04-07T02:07:20+02:00
I have tried the usual basics (restart XCode, disable-re-enable dev mode, perform a clean build), but to no avail. What could be going wrong here? I suspect this has to do with the phone or the pairing, since the same applications perfectly work on the Simulator or on my other devices.