Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest May 19th, 2017 45 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. import Foundation
  2.  
  3. class Type: NSObject {
  4.     let value = 1
  5. }
  6.  
  7. struct MyString : ExpressibleByStringLiteral {
  8.    
  9.     init(stringLiteral value: String) {}
  10.     init(unicodeScalarLiteral value: String) {}
  11.     init(extendedGraphemeClusterLiteral value: String) {}
  12. }
  13.  
  14. // StringLiteralType を変更すると #keyPath から推論される型も変化するみたい
  15. typealias StringLiteralType = MyString
  16.  
  17. let path = #keyPath(Type.value)
  18.  
  19. type(of: path)      // __lldb_expr_72.MyString
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
 
Top