r_levkovych

Interesting feature

Sep 27th, 2020
1,056
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.20 KB | None | 0 0
  1. struct Object {
  2.     let name: String
  3.     let id: Int
  4. }
  5.  
  6. let array = [
  7.     Object(name: "obj1", id: 1),
  8.     Object(name: "obj2", id: 2),
  9.     Object(name: "obj3", id: 3)
  10. ]
  11.  
  12. let vars = array.map(\.id)
Advertisement
Add Comment
Please, Sign In to add comment