//: Playground - noun: a place where people can play
import UIKit
import Foundation
//Пробовать с разными - раскоментаривать по очереди
var someString: String? = "bjbb"
//var someString: String? = "3456"
//var someString: Int? = 3456
//var someString: Int?
func CastToInt32(someId: Any?) -> Int32? {
var identifier: Int32?
if let stateCode = someId as? Int ?? Int(someId as? String ?? "") {
identifier = Int32(stateCode)
return identifier
} else {
return nil
}
}
let myInt32 = CastToInt32(someId: someString)