The idea is to write a couple of helpers to convert a String to a Signed Integer, and back.

Yes, I am aware you can cast values:

let x: Int = 42

var asString = String(x)
assert("42" == asString)

let asInt = Int(asString)
assert(x == asInt)

But let’s try to explore alternative solutions. I will split this into two different posts to keep them concise. String to Integer Conversion and Integer to String Conversion

As usual, a playground with examples is uploaded to GitHubGist