that someone made to me on twitter - this was a pretty good joke, but it should give you the idea that this talk will involve more than just mobile apps.
fortunate enough to have learned some new things here and there, but at the time of this story that i'm going to tell you, I only knew mobile. but, life was good! ever since apple forced me to learn Swift (or else), I was happy with functional programming !"
a lot of money. things were simple, and I was living the dream. However, one day, the server dev went home sick, passing away in a bizarre gardening accident. !"
shivering cold abyss of having to figure out how to handle servers. what was I going to do now? I hadn't really dont anything with servers, so I was a bit nervous about diving into a world I knew nothing about. !
to handle server side code, while simultaneously worrying about how to maintain a server? How will I work with a load balancer? How do I deploy to a server? WHAT WILL I DO?!?!?!?!?! !
of serverless can be tremendously helpful for me who just needs to "get it done", and this came across as a bit of a lifesaver. SERVERLESS NOW WITH SWIFT!
to think about what my responsibility really was when it came to "serverless" development. Thankfully, Jenny was able to explain it to me with a quote that still sticks with me, and perfectly
where the existence of servers is simply hidden from developers. I.e. that even though servers still exist developers are relieved from the need to care about their operation. They are relieved from the need to worry about low-level infrastructural and operational details such as scalability, high- availability, infrastructure-security, and so forth.”
a function!" And she showed me this, telling me that there are a couple of things to point out here. func main(args: [String:Any]) -> [String:Any] { guard let name = args["name"] as? String else { return ["error" : "No name included"] } return ["output" : "Sick presentation, \(name)!"] }
must be passed in as "args" func main(args: [String:Any]) -> [String:Any] { guard let name = args["name"] as? String else { return ["error" : "No name included"] } return ["output" : "Sick presentation, \(name)!"] }
I could get this working on my local machine, but I knew nothing about deploying to the cloud. I mean, I only work for IBM, so cloud computing doesn't come naturally to me. So I asked how I can get this going, and she told me, "look, it's just 5 easy steps." !
be ready to go", she told me. wsk action create swiftAction function.swift wsk action update swiftAction function.swift wsk action invoke swiftAction --param name David wsk action invoke swiftAction --param name David -b wsk action invoke swiftAction --param name David -b -r
me to think of an action like a file that runs a set of functions I can type in. all I have to do is reference the file in this command, name my action, and I'm ready to go. wsk action create swiftAction function.swift wsk action update swiftAction function.swift wsk action invoke swiftAction --param name David wsk action invoke swiftAction --param name David -b wsk action invoke swiftAction --param name David -b -r
way my action works with this command. wsk action create swiftAction function.swift wsk action update swiftAction function.swift wsk action invoke swiftAction --param name David wsk action invoke swiftAction --param name David -b wsk action invoke swiftAction --param name David -b -r
this action, I'll need to invoke it. I can specify as many parameters as I want this way wsk action create swiftAction function.swift wsk action update swiftAction function.swift wsk action invoke swiftAction --param name David wsk action invoke swiftAction --param name David -b wsk action invoke swiftAction --param name David -b -r
returned to me but an ID. she told me that this is because these functions are returned asynchronously. I wanted to try them out right in the CLI, so she told me to add the - b, which stands for "blocking". This makes it so that I can see all the output returned right in my cli. wsk action create swiftAction function.swift wsk action update swiftAction function.swift wsk action invoke swiftAction --param name David wsk action invoke swiftAction --param name David -b wsk action invoke swiftAction --param name David -b -r
call, which stands for "result". So i added this to my command, and boom! wsk action create swiftAction function.swift wsk action update swiftAction function.swift wsk action invoke swiftAction --param name David wsk action invoke swiftAction --param name David -b wsk action invoke swiftAction --param name David -b -r
up a swift action, calling out to an API, using Swift you already know to modify the output, and sending it back down in your response. Ideally, you'll leave the lab with a live Swift function, ready to go. HANG OUT WITH ME FROM 3:00 - 4:00 PM FOR A HANDS- ON LAB WHERE WE'LL GET THE PRICE OF BITCOIN!