Skip to content

Instantly share code, notes, and snippets.

@erdemildiz
Created July 19, 2021 11:05
Show Gist options
  • Save erdemildiz/30edebaee81014f0e7805ff3d72d0b98 to your computer and use it in GitHub Desktop.
Save erdemildiz/30edebaee81014f0e7805ff3d72d0b98 to your computer and use it in GitHub Desktop.
infix operator ++
func ++(initialText: String, nextText: String) -> String {
initialText + " " + nextText
}
// Usage
let combinedName = names.reduce("", ++)
// Result
// My name is Tom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment