Skip to content

Commit b512aea

Browse files
committed
Improve UIAlertController titleVisibility handling
1 parent db6bc9d commit b512aea

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Sources/UIKitNavigation/Navigation/UIAlertController.swift

+11-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,17 @@
3737
handler: @escaping (_ action: Action?) -> Void = { (_: Never?) in }
3838
) {
3939
self.init(
40-
title: state.titleVisibility == .visible ? String(state: state.title) : nil,
40+
title: {
41+
switch state.titleVisibility {
42+
case .automatic:
43+
let title = String(state: state.title)
44+
return title.isEmpty ? nil : title
45+
case .hidden:
46+
return nil
47+
case .visible:
48+
return String(state: state.title)
49+
}
50+
}(),
4151
message: state.message.map { String(state: $0) },
4252
preferredStyle: .actionSheet
4353
)

0 commit comments

Comments
 (0)