Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 436 Bytes

File metadata and controls

13 lines (9 loc) · 436 Bytes

1.Extensions的作用

  • Add computed instance properties and computed type properties
  • Define instance methods and type methods
  • Provide new initializers
  • Define subscripts
  • Define and use new nested types
  • Make an existing type conform to a protocol 类似OC中的类别(Category) 注:Extensions can add new computed properties, but they cannot add stored properties, or add property observers to existing properties.