Skip to content

Instantly share code, notes, and snippets.

@natecook1000
Last active April 15, 2023 07:56
Show Gist options
  • Save natecook1000/43743b67b6753acaf4ca to your computer and use it in GitHub Desktop.
Save natecook1000/43743b67b6753acaf4ca to your computer and use it in GitHub Desktop.
Swift-only homogeneousnessedness
extension String {
var isHomogeneous: Bool {
if let firstChar = characters.first {
for char in dropFirst(characters) where char != firstChar {
return false
}
}
return true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment