Guest User

Untitled

a guest
Jun 14th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. struct unityAuthenticationRequest: Codable {
  2. var username : String
  3. var password : String
  4. }
  5.  
  6. enum test {
  7. case volume
  8. case num2
  9. case num3
  10.  
  11. var codableParam: Encodable? {
  12. switch self {
  13. case .volume:
  14. return unityAuthenticationRequest(username: "uname", password: "pwrods")
  15. default:
  16. return nil
  17. }
  18. }
  19. }
  20.  
  21. func saveObject<T:Encodable>(_ object: T) {
  22. let data = try? JSONEncoder().encode(object)
  23. }
  24.  
  25. func dx<T: Codable>(fx: T) {
  26. let datax = try? JSONEncoder().encode(fx)
  27. }
  28.  
  29. let r = test.volume
  30. saveObject(r.codableParam)
Add Comment
Please, Sign In to add comment