The Swift Alps Conference has a special format focused on experimentation and collaboration. This is my report of the conference and the workshop Kilian and I held. The slides are available below.
Last month my colleague Kilian and I were pleased to attend the Swift Alps Conference, an experimental conference about Swift taking place in the Swiss Alps. This conference had a different format from what one can expect from a typical software development conference. In this case the format was more focused in experimenting and collaborating with other attendees with the goal of learning something new.
Experimenting with strangers
The first session of the animation workshop with @manuelescrig at #swiftalps is in full swing pic.twitter.com/9Cumo7sks3
â Liip (@liip) November 11, 2016
The venue was located in the Swiss canton of Valais, in Crans-Montana, which is a ski resort in the heart of the Swiss Alps.
The combination of this specific location with the amount of  snow, made the conference even more magical, if possible.
Views from the venue
Current view from the @swiftalps pic.twitter.com/f77uIsDAjt
â Manuel Escrig (@manuelescrig) November 11, 2016
Talking about animations
My colleague Kilian and I were in charge of being mentors and creating a workshop about animations in Swift. We decided to talk about how animations can improve the overall user experience of an app together with all the different benefits that they can bring to the user. In addition we talked about the 12 basic principles of animations in design.
Slides from the workshop
The main part of being a mentor in the conference was running different workshops during the day where attendees could join and build/create/learn something new related to the topic of the workshop. We proposed to the attendees to build something with animations using Swift. The 3 proposals we gave were, 1.- Snow background effect, 2.- Cowbell notification badge and 3.- Cheese view transition. Here we'll just cover the first proposal of how to implement a snow background effect using Core Animation in Swift.
Snow background effect
Using CAEmitterLayer from Core Animation we accomplished the following result.
In order to accomplish the effect, we need to create an instance of CAEmitterLayer, then append to that instance of CAEmitterLayer the different CAEmitterCell that represent the snow flakes.
func startSnowing() {
emitter = CAEmitterLayer()
emitter.emitterPosition = CGPoint(x: view.frame.size.width / 2.0, y: 0)
emitter.emitterShape = kCAEmitterLayerLine
emitter.emitterSize = CGSize(width: view.frame.size.width, height: 1)
var cells = [CAEmitterCell]()
cells.append(snowFlakeWith(color:UIColor.white))
emitter.emitterCells = cells
view.layer.addSublayer(emitter)
}
To stop effect, just change the birthRate parameter in the CAEmitterLayer instance.
func stopSnowing() {
emitter?.birthRate = 0
}
You can append to CAEmitterLayer different instances of CAEmitterCell with different behaviour in order to accomplish a natural movement.
func snowFlakeWith(color: UIColor) {
let image = #imageLiteral(resourceName: "flake")
let whiteImage = image.maskWithColor(color: UIColor.white)
let flake = CAEmitterCell()
flake.birthRate = 50.0 * intensity
flake.lifetime = 14.0 * intensity
flake.lifetimeRange = 0
flake.color = color.cgColor
flake.velocity = CGFloat(350.0 * intensity)
flake.velocityRange = CGFloat(80.0 * intensity)
flake.emissionLongitude = CGFloat(M_PI)
flake.emissionRange = CGFloat(M_PI_4)
flake.spin = CGFloat(3.5 * intensity)
flake.spinRange = CGFloat(4.0 * intensity)
flake.scaleRange = CGFloat(intensity)
flake.scaleSpeed = CGFloat(-0.1 * intensity)
flake.scale = 0.1
flake.contents = whiteImage?.cgImage
return flake
}
Link to the project example.
github.com/manuelescrig/SwiftAlps2016
Summary
We want to thank the Swift Alps conference organizers for creating and putting together such an awesome event! Indeed, by looking at the reactions of the people, we can say it was a great success. Also thanks to the other mentors for sharing all their knowledge with us, and spending time together. Finally a big thank you to the rest of the participants for bringing such a cool vibe to the conference, making it a really special event.
Manuel Escrig @manuelescrig