SHARE
TWEET

Untitled

a guest Nov 17th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. struct Person {
  2.     var firstName: String
  3.     var lastName: String
  4.     var fullName: String {
  5.         return firstName + " " + lastName
  6.     }
  7.     var age: String {
  8.         didSet {
  9.             let numAge = Int(age)
  10.             var ageScalars = age.unicodeScalars
  11.             if numAge == nil {
  12.                 print("vnimane vozrast vveden neverno")
  13.                 ageScalars.removeAll{!charSet.contains($0)}
  14.                 age.unicodeScalars = ageScalar
  15.             }
  16.         }
  17.     }
  18.     let charSet = CharacterSet.decimalDigits
  19. }
  20. var person = Person(firstName: "Aziz", lastName: "Xuesos", age: "89h")
  21. print(person.age)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top