Advertisement
teonoman

What is capitalized Self in Swift?

Jul 2nd, 2017
5,563
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.30 KB | None | 0 0
  1. protocol MyProtocol {
  2.     static func foo() -> Self
  3.     static func bar()
  4.     static func baz()
  5. }
  6.  
  7. extension MyProtocol {
  8.     static func foo() -> Self {
  9.         return Self()
  10.     }
  11.  
  12.     static func bar() {
  13.         print("Something")
  14.     }
  15.  
  16.     static func baz() {
  17.         Self.bar()
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement