Fix compilation error in Swift machine template

Existing template don't compile in Xcode due to improper handling of Optionals