Skip to content

Instantly share code, notes, and snippets.

@wtsnz
Created June 23, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtsnz/a47709427c45c925535b to your computer and use it in GitHub Desktop.
Save wtsnz/a47709427c45c925535b to your computer and use it in GitHub Desktop.
extension UIDevice {
/**
Returns the name of the current devices' owner, maybe.
Usually iPhones are named something like "Will's iPhone", or "Will's iPad", this method is a simple, unreliable way of getting the persons name from that string.
:returns: Optional string that might be the owners name.
*/
func ownersName() -> String? {
return UIDevice.currentDevice().name.componentsSeparatedByString("'").first
}
}
@HearkOld
Copy link

Well done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment