Moving error message construction to separate function

This is simply for clarity and ease of refactoring.
Using 4 spaces for indentation

This appears to be the consensus, and it's the setting in swift.vim
Removing unnecessary NSString type.
Typecasting to NSData using `as`

This appears to be the preferred convention.
Unwrapping rather than casting inputString in `input`
Unwrapping rather than casting errorMessageData