try!Swift recap! 1st day PM #tryswiftconf



This is a translated version of the article below. I translated the article. Because I'm not a bilingual, it may contain mistranslations. It will be good if you can feel atmosphere of try!Swift :)

  • try! Swift 最速レポート 1日目午後
  • Our reports

    Translated versions (still on the way to translate!)

    • try!Swift recap! 1st day AM #tryswiftconf
    • try!Swift recap! 2nd day AM #tryswiftconf
    • try!Swift recap! 2nd day PM #tryswiftconf
    • try!Swift recap! 3rd day AM #tryswiftconf
    • try!Swift recap! 3rd day PM #tryswiftconf

    Original Japanese versions

    try! Swift A fastest report for the 1st day PM

    This is a second report of try! Swift conf. following Jun Kato report.

    Hi! I'm Tammy Tocky (Tokihiko Tamiya) at Markcity in Shibuya.

    Here I am at big conference try! Swift for / by Swift developers!

    Developers.IO will report whole 3-days-event.

    Swift developers around the world are gathering at this conference to share their knowledges and techniques of Swift.

    Let's get started for afternoon sessions!


    Three Stories about Error Handling in Swift

    Protocols and the Promised Land

    Blending Cultures

    Advanced Graphics with Core Animations

    Code for the Smart Home

    How To Be Invisible

    Three Stories about Error Handling in Swift

    Sample codes - Three Stories about Error Handling in Swift

    Presented by Yuta Koshizawa



    Error Handling

    • Error handling in C
    • Error handling in Java
      • Complication Error
      • Ignore errors with !
    • Error handling in Swift
      • Optional Handling
      • if let ~ else
        • Error handling lazily
    • Syntax sugar
    • Optional chaining
    • Safety other programing languages can't realize come true
    • Optional is a kind of evolution.

    Success or Failure

    • Alternatives of optionals
      • Tuple
      • Union Types
      • Results
        • Difficulty of using Results
        • It's getting harder to read codes along with the number of nesting.
      • Results without Error Type
      • ResultK

    try catch


    • Automatic Propagation
      • It's useful to handle multiple errors.
      • It's hard to write code if you handle errors manually.
    • Marked propagation
    • Marked Automatic Propagation for Optionals
      • You can get nil as a null value.
    • Results and try
    • Asynchronous processing and try

    Protocols and the Promised Land

    Former presentation - Swift Protocols and the Promised Land, with Michele Titolo - Realm is a mobile database: a replacement for SQLite & Core Data

    Presented by Michele Titolo



    • Swift is not Objective-C
    • as? as? as? It's boring.
    • @objc will spread out like viruses.
    • @objc class Myclass: NSObject, SomeProtocol{}
    • can't conform, can't subclass (swift → Objective-C)

    • Bridging

    • Generics and others can't be converted to Objective-C code.
    • Think again. Is it necessary to convert to Objective-C code?
    • use @import
    • bridging


    • Type System
      • Properties have only one type.
      • "Swifty" coding.
      • Can't override types with inheritances
      • Deep class inheritance hierarchies are not good.
    • Protocols
      • Combine protocols
      • It's not good to mix protocols and codes with inheriting classes
      • Make good use of Protocol Oriented Programing to mock.
    • Generics
      • We can't reference a generic protocol
      • Generic non-NSObject have issues
    • Awesome new patterns of swift

    Blending Cultures

    Presented by Daniel Steinberg



    • MVC model
    • The example of Table View Controller

    Be Sensitive to Immutable

    • Don't use classes but Structs.
    • Structs need to be mutated.
      • from let to var
    • Erase mutatitng
      • Like functional programing
      • Make mutable local copy, and modify it, and make new instance of it.
      • It's useful to be able to write in method chaining manner.


    • Exclude data souces from Table View Controller.
    • Protocols
      • Data source class based on source type
      • addNewItemAtIndex
      • deleteItemAtIndex
      • moveItem(fromIndex: Int, toIndex:Int) -> Self
    • Use data type, not source type.
    • Template pattern
    • Blending OOP, FP, and POP will realize a new world.

    Advanced Graphics with Core Animations

    Presented by Tim Oliver




    • Introducing Core Animation
    • How to implement animation
    • How to use subclasses of CALayer.

    Introduction of Core Animation

    • It's the base of UIKit
      • It's connected to UIView deeply.
      • GPU will handle operations in the end.
    • A hierarchy of layer objects.
    • Why do we use Core Animation?

      • Understanding graphic system of iOS.
      • We can aim at 60fps more easily.
      • More beautiful graphics than UIView can realize. More complex animations than UIView can realize.
      • These features make apps more wonderful than others.
    • Core Graphics and Core Animation
      • API to generate graphics.
      • Run on CPU totally.
      • Very slow animation on previous devices.
      • It's good to combine with Core Animation.
      • Generate Core Graphics elements with Paint Code/

    How to implement animations


    • CALayer
      • Properties are presented with UIView.
      • Frame is converted to CALayer's position and bounds property.
      • You can realize effects like Tweetbot - expand graphic elements vertically.
      • scaling graphics
      • Blending mask
      • add shadows
      • Transform
        • Flipboard's animations
      • revealapp
    • easing
    • CAAnimationGroup
    • Animation Completion Handling
    • Core Animator on the Mac App Store

    How to use subclasses of CALayer

    • Special effects with GPU
    • CATileLayer
      • Render multiple sizes of original graphics.
      • It's used on the viewer of PDF and SVG
    • CAGradientLayer
      • gradation
    • CAReplicaterLayer
      • Draw multiple copies of one layer.
    • CAShapeLayer
      • Draw and animate various shapes using CGPath.
    • CAEmitterLayer
      • Particles
    • Other Layer Subclass
      • UILabel and CATextLayer
      • Scroll big contents - CAScrollLayer
      • Perfect 3D transition - CATransformLayer
      • CAEAGLLayer for games


    • If we think of UI, use CALayer.
    • We can realize cool effects with 60fps.
    • It's hard to handle CALayer. I recommend to use UIKit at first.

    Code for the Smart Home

    Presented by Stephanie Shupe



    • There are products to realize Smart Technology + Home
      • Clocks, coffee makers, lightings, bathrooms, etc.
    • We can make things in a house communicate each other with Apples HomeKit framework.
    • Lighting equipments

    • HMHome
      • HMRoom
      • HMUser
      • HMAccessory
        • HMService
          • HMCharacteristic
            • Read / Write
              • Status, Brightness, Saturation, etc.
          • HMHomeManager
          • HMHomeDelegate
    • Control Lighting equiptments with HomeKit
      • Add Light Bulb Switch to the app.
      • Watch at the light - whether the light is ON.
      • Monitor the status of light equipments.
    • Initialize HMHomeManager. Set up delegate.
    • Write codes of methods and delegate methods.
    • Read values from Characteristic
    • What will happen if someone else turn ON / OFF lights?
      • Monitor the lights
      • Solve the problem with delegate methods.
      • Event notifications come.
      • We can fetch rawValues
    • Demo
      • Stephanie asked Siri to change the color of light into red and the color changed as she said.
      • She controlled brightness on the screen of iPhone.
    • HomeKit Accessory Simulator!
    • Philips Hue
      • Pholips Hue App



    • The future of HomeKit
      • It's possible that new HomeKit accessories will come by someone and Apple.
    • How HomeKit is treating Outsider to be secure?
      • It's tied to iCloud. Apple is controlling security and it's good enough at the scope.
    • Control devices from outside of the house with iCloud and a phone
      • I think it's possible with server side codes and SDKs

    How To Be Invisible

    Presented by Cate Huston



    • Digital Crack
    • Absorbing
    • Addictive things
    • The important thins is not only how much money users spend on the app but also how useful is the app for users.
    • SHOW & HIDE app
    • Fetch location information in backgrund
      • Update location information every 5 minutes
      • precision of the location information.
      • iPhone's battery will give out within one hour if we fetch precise location information.
      • Not to use battery so often. Caching locational information
      • We could make users not to aware of the presence of the app.
    • We wanted to bring various rich devices, such as 3D printers and motion capture devices, into mobile world.
    • Don't show data. Show dicisions.
      • Such as weather forecasts.
        • The important thing is to make decision such as "what clothes will I wear today?"
      • Such as locational informationo
        • Converting locational information into trafic information. Find out trafic jams and decide the route to the goal.
    • Foursquare


    • I realized that the pattern of my daily activity is influenced by the app.
    • But that is not addictive and Digital Crack.
    • Slack

      • Bringing us to the world with new digital interfaces.
      • Bots change patterns of our daily activities.
      • It's important for computer to speak like human.
      • Think of good error messages. Pay attention to what users want to do.
    • UX
      • Speaking computers we see on the movies are still dream.


    The 1st day sessions was so exciting for me that I can't live without Swift. I and Takaaki Tanakawill bring you the latest sessions. Stay tuned!