You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2017/11/08 14:33:30 UTC

[GitHub] csantanapr commented on issue #2: Swift 4 support with Codable

csantanapr commented on issue #2: Swift 4 support with Codable
URL: https://github.com/apache/incubator-openwhisk-runtime-swift/issues/2#issuecomment-342509355
 
 
   User can define Codable interface or traditional dictionary
   In terms of User experience they I want to make it dead simple
   dict in dict out
   ```swift
   func main(args: [String:Any]) -> [String:Any] {
      return args
   }
   ```
   codable
   ```swift
   struct Employee: Codable {
     let id: Int
     let name: String
   }
   func main(input: Employee, respondWith: (Employee?, RequestError?) -> Void) -> Void {
       respondWith(input, nil)
   }
   ```
   
   deployment looks the same for both
   ```
   wsk action create helloAction hello.swift --kind swift:4
   wsk action invoke helloAction -p id 42 -p name Carlos -r
   {
     "id":42,
     "name":Carlos
   }
   ```
   
   epilogue.swift will handle how to call the function based on signature. 
   
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services