Skip to content

Instantly share code, notes, and snippets.

@wonderbit
Created December 12, 2022 06:47
Show Gist options
  • Save wonderbit/a334714d12d70d011829f8b9247097f5 to your computer and use it in GitHub Desktop.
Save wonderbit/a334714d12d70d011829f8b9247097f5 to your computer and use it in GitHub Desktop.
Print easy to read description of UICellConfigurationState
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