Skip to content

Instantly share code, notes, and snippets.

@christianselig
Created October 9, 2024 19:52
Show Gist options
  • Save christianselig/81f326db637efa708542129f08a85669 to your computer and use it in GitHub Desktop.
Save christianselig/81f326db637efa708542129f08a85669 to your computer and use it in GitHub Desktop.
struct MyWrapper {
let key: String
let value: any Codable
}
let point: CGPoint? = nil
let wrapper = MyWrapper(key: "point", value: point)
// ⚠️ Comparing non-optional type always returns false
// … but it IS nil :(
if wrapper.value == nil {
print("nil value")
} else {
print("continue…")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment