A list of awesome bugs with SwiftUI, Swift, etc. Includes code examples and possible workarounds to help developers navigate common pitfalls.
- Memory leak when applying
.searchable
and.refreshable
modifiers together on aScrollView
. - Button action is not canceled during scrolling in a sheet and is executed after scrolling completes.
- Gesture issue:
.updating
block is not called onLongPressGesture
. - Gesture issue: when
DragGesture
is added as a.highPriorityGesture
to aList
orScrollView
, scrolling stops working. - NavigationStack issue: popping back programmatically doesn't work when using
.navigationDestination(isPresented:)
. - NavigationStack issue: when clearing a path, it does not go back if there was a transition with an active
.searchable
. - Sheet issue:
.presentationDetents
is ignored if the sheet is reopened after a short period. - Sheet issue: if you have multiple
.sheet
s open, when you restore the state, not all of them will be presented, and after that.sheet
won't be open even manually until you close the previous one. - NavigationSplitView issue: toolbar items disappear after the app goes to the background and then returns to the foreground.
- TabView issue: wrong tab displayed after rotation when using
.page
style. - @State issue: the same variable is shared between different scenes.
- PhaseAnimator crash: when closing the presented view or popping the pushed view on which it is (or 100% CPU load iOS 17.0).
- Alert issue:
.default
and.cancel
buttons are recolored if alert in aNavigationStack
that has.tint
applied (or higher up the Views tree). - Animation glitch on drag and drop action.
- Life cycle of controllers when the new one is immediately pushed with
animation: true
. - UIBezierPath issue:
cornerRadius
is incorrect forroundedRect
when it exceeds ~65.5% of half ofmin(width, height)
. - Navigation title is displayed in quotation marks
" "
if a whitespace is specified as the title.
- Crash occurs when using a typed throws in a closure variable within an
ObservableObject
. - Crash in Swift 6 language mode when using the closure-based version of the
UNUserNotificationCenter.requestAuthorization
function. - Compilation error if
Observable
class name isMember
. - Compilation error when passing a function isolated to an actor as an argument.
- Compilation error if
Observable
class name isMember
. - Compilation error when passing a function isolated to an actor as an argument.
- Entry macro issue: generated variable
defaultValue
is a computed property if the variable type is explicitly specified, but a stored property if the variable type is not specified explicitly.
- SwiftData crash: deleting the element will result in a crash in the standard template.
- Memory leak when applying
.searchable
and.refreshable
modifiers together on aScrollView
. - Crash occurs when using a typed throws in a closure variable within an
ObservableObject
. - Crash in Swift 6 language mode when using the closure-based version of the
UNUserNotificationCenter.requestAuthorization
function. - Button action is not canceled during scrolling in a sheet and is executed after scrolling completes.
- Gesture issue:
.updating
block is not called onLongPressGesture
. - Gesture issue: when
DragGesture
is added as a.highPriorityGesture
to aList
orScrollView
, scrolling stops working. - NavigationStack issue: popping back programmatically doesn't work when using
.navigationDestination(isPresented:)
. - NavigationStack issue: when clearing a path, it does not go back if there was a transition with an active
.searchable
. - Sheet issue:
.presentationDetents
is ignored if the sheet is reopened after a short period. - Sheet issue: if you have multiple
.sheet
s open, when you restore the state, not all of them will be presented, and after that.sheet
won't be open even manually until you close the previous one. - TabView issue: wrong tab displayed after rotation when using
.page
style. - @State issue: the same variable is shared between different scenes.
- PhaseAnimator crash: when closing the presented view or popping the pushed view on which it is (or 100% CPU load iOS 17.0).
- Alert issue:
.default
and.cancel
buttons are recolored if alert in aNavigationStack
that has.tint
applied (or higher up the Views tree). - UIBezierPath issue:
cornerRadius
is incorrect forroundedRect
when it exceeds ~65.5% of half ofmin(width, height)
. - Animation glitch on drag and drop action.
- Navigation title is displayed in quotation marks
" "
if a whitespace is specified as the title.
- Crash occurs when using a typed throws in a closure variable within an
ObservableObject
. - Crash in Swift 6 language mode when using the closure-based version of the
UNUserNotificationCenter.requestAuthorization
function. - Gesture issue:
.updating
block is not called onLongPressGesture
. - Gesture issue: when
DragGesture
is added as a.highPriorityGesture
to aList
orScrollView
, scrolling stops working. - NavigationSplitView issue: toolbar items disappear after the app goes to the background and then returns to the foreground.
- TabView issue: wrong tab displayed after rotation when using
.page
style. - @State issue: the same variable is shared between different scenes.
- PhaseAnimator crash: when closing the presented view or popping the pushed view on which it is (or 100% CPU load iOS 17.0).
- SwiftData crash: deleting the element will result in a crash in the standard template.
- Alert issue:
.default
and.cancel
buttons are recolored if alert in aNavigationStack
that has.tint
applied (or higher up the Views tree). - UIBezierPath issue:
cornerRadius
is incorrect forroundedRect
when it exceeds ~65.5% of half ofmin(width, height)
. - Navigation title is displayed in quotation marks
" "
if a whitespace is specified as the title.
- @State issue: the same variable is shared between different scenes.
- Crash occurs when using a typed throws in a closure variable within an
ObservableObject
. - @State issue: the same variable is shared between different scenes.
- @State issue: the same variable is shared between different scenes.
- Crash occurs when using a typed throws in a closure variable within an
ObservableObject
. - @State issue: the same variable is shared between different scenes.
Memory leak when applying .searchable
and .refreshable
modifiers together on a ScrollView
.
A video demonstrating how it behaves on iOS 17.2 without a memory leak and on iOS 18.2 with a memory leak.
demo.mp4
Crash in Swift 6 language mode when using the closure-based version of the UNUserNotificationCenter.requestAuthorization
function.
Images with the result.
Button action is not canceled during scrolling in a sheet and is executed after scrolling completes.
A video demonstrating how it works on iOS 17 and iOS 18.
gestures.mp4
Gesture issue: .updating
block is not called on LongPressGesture
.
A video demonstrating how it behaves on iOS 18 and iOS 17.
gesture_updating.mp4
Gesture issue: when DragGesture
is added as a .highPriorityGesture
to a List
or ScrollView
, scrolling stops working.
A video demonstrating how it behaves on iOS 17 and iOS 18.
drag_high_priority_gesture.mp4
NavigationStack issue: popping back programmatically doesn't work when using .navigationDestination(isPresented:)
.
A video demonstrating how it behaves on iOS 16 and iOS 17.
1732264172150-ezgif.com-gif-to-mp4-converter.mp4
NavigationStack issue: when clearing a path, it does not go back if there was a transition with an active .searchable
.
A video demonstrating how it behaves on iOS 17 and iOS 18.
1731658771630-ezgif.com-gif-to-mp4-converter.mp4
Sheet issue: .presentationDetents
is ignored if the sheet is reopened after a short period.
A video demonstrating how it behaves on iOS 18.
sheet_detents.mp4
Sheet issue: if you have multiple .sheet
s open, when you restore the state, not all of them will be presented, and after that .sheet
won't be open even manually until you close the previous one.
A video demonstrating how it behaves.
sheet_restoration.mp4
Life cycle of controllers when the new one is immediately pushed with animation: true
.
Comparison images on iOS 18 and earlier.
Crash occurs when using a typed throws in a closure variable within an ObservableObject
.
Video showing how it works up to but not including iOS 18.0.
typedthrows.mp4
Compilation error if Observable
class name is Member
.
Compilation error when passing a function isolated to an actor as an argument.
NavigationSplitView issue: toolbar items disappear after the app goes to the background and then returns to the foreground.
A video demonstrating how it behaves on iOS 18.
1730448296047.mp4
Entry macro issue: generated variable defaultValue
is a computed property if the variable type is explicitly specified, but a stored property if the variable type is not specified explicitly.
Image comparing the code generated by the macro
- TabView issue: wrong tab displayed after rotation when using
.page
style.
A video demonstrating how it behaves on iOS 15.
tabview_tab_roatation.mp4
@State issue: the same variable is shared between different scenes.
A video demonstrating how it behaves on iPadOS 17.4 and 17.5.
state.mp4
- PhaseAnimator crash: when closing the presented view or popping the pushed view on which it is (or 100% CPU load iOS 17.0).
A video demonstrating how it behaves on iOS 17.2.
phaseanimator_crash.mp4
Alert issue: .default
and .cancel
buttons are recolored if alert in a NavigationStack
that has .tint
applied (or higher up the Views tree).
Video showing how it works on iOS 18.1 and iOS 18.2.
alert_buttons_tint.mp4
SwiftData crash: deleting the element will result in a crash in the standard template.
A video demonstrating how it behaves on iPadOS 17.5.
swift_data_crash.mp4
- UIBezierPath issue:
cornerRadius
is incorrect forroundedRect
when it exceeds ~65.5% of half ofmin(width, height)
.
A video demonstrating how it behaves on iOS 18.
uibezierpath_cornerradius.mp4
Animation glitch on drag and drop action.
A video showing how it works on iOS 18.0.
1736496554750-ezgif.com-gif-to-mp4-converter.mp4
Navigation title is displayed in quotation marks " "
if a whitespace is specified as the title.
Comparison images on iOS 18 and earlier storyboard/code.
Contributions welcome! See the guidelines.