         
         // By default, transition starts from the center of the screen,
         // so let's find the center when segue is first initialized
-        let centerX = UIScreen.mainScreen().bounds.width*0.5
-        let centerY = UIScreen.mainScreen().bounds.height*0.5
-        let centerOfScreen = CGPointMake(centerX, centerY)
+        let centerX = UIScreen.main.bounds.width*0.5
+        let centerY = UIScreen.main.bounds.height*0.5
+        let centerOfScreen = CGPoint(x:centerX, y:centerY)
         
         // Initialize properties
         circleOrigin = centerOfScreen

        return animation
    }
    
    private func startAndEndPaths(shouldUnwind: Bool) -> (start: CGPathRef, end: CGPathRef) {
        
        // The hypothenuse is the diagonal of the screen.
        // Further, we use this diagonal as the diameter of the big circle.
        // This way we are always certain that the big circle will cover the whole screen.
        // TODO: Clean up below implementation
        let width = UIScreen.mainScreen().bounds.size.width
        let height = UIScreen.mainScreen().bounds.size.height
        let rw = width + fabs(width/2 - circleOrigin.x)
        let rh = height + fabs(height/2 - circleOrigin.y)
        let h1 = hypot(width/2 - circleOrigin.x, height/2 - circleOrigin.y)
        let hyp = CGFloat(sqrtf(powf(Float(rw), 2) + powf(Float(rh), 2)))
        let dia = h1 + hyp
        
        //print("h1: \(h1) hyp: \(hyp) rw: \(rw) rh: \(rh) width: \(width) height: \(height)")
        
        // The two circle sizes we will animate to/from
        let path1 = UIBezierPath(ovalInRect: CGRectZero).CGPath
        let path2 = UIBezierPath(ovalInRect: CGRectMake(-dia/2, -dia/2, dia, dia)).CGPath
        
        // If shouldUnwind flag is true, we should go from big to small circle, or else go from small to big
        return shouldUnwind ? (path1, path2) : (path2, path1)

//
//  OHOHCircleSegue.swift
//  OHOHCircleSegue
//
//  Created by Øyvind Hauge on 10/01/16.
//  Copyright © 2016 Øyvind Hauge. All rights reserved.
