Created
December 12, 2022 06:47
-
-
Save wonderbit/a334714d12d70d011829f8b9247097f5 to your computer and use it in GitHub Desktop.
Print easy to read description of UICellConfigurationState
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UICellConfigurationState { | |
func debugPrint() { | |
var statuses: [String] = [] | |
if isFocused { statuses.append("focused") } | |
if isHighlighted { statuses.append("highlighted") } | |
if isSelected { statuses.append("selected") } | |
if isSwiped { statuses.append("swiped") } | |
if isEditing { statuses.append("editing") } | |
if isDisabled { statuses.append("disabled") } | |
if isExpanded { statuses.append("expanded") } | |
if isReordering { statuses.append("reordering") } | |
if #available(iOS 15, *), isPinned { statuses.append("focused") } | |
var dragState = "" | |
switch cellDragState { | |
case .dragging: | |
dragState = "dragging" | |
case .lifting: | |
dragState = "lifting" | |
case .none: | |
dragState = "none" | |
default: | |
dragState = "unknown" | |
} | |
var dropState = "" | |
switch cellDropState { | |
case .targeted: | |
dropState = "targeted" | |
case .notTargeted: | |
dropState = "notTargeted" | |
case .none: | |
dropState = "none" | |
default: | |
dropState = "unknown" | |
} | |
print("Status: \(statuses.joined(separator: ", ")), dragState: \(dragState), dropState: \(dropState)") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment