Safe versions of standard functions and features in Swift