├── README.md
└── ValentinesSwift.playground
├── Contents.swift
├── Resources
└── screenshot.png
├── contents.xcplayground
├── playground.xcworkspace
├── contents.xcworkspacedata
└── xcuserdata
│ └── simongladman.xcuserdatad
│ └── UserInterfaceState.xcuserstate
└── timeline.xctimeline
/README.md:
--------------------------------------------------------------------------------
1 | # ValentinesSwift
2 | You love Swift & Swift loves you!
3 |
4 | 
5 |
--------------------------------------------------------------------------------
/ValentinesSwift.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import XCPlayground
3 |
4 | //: # Happy Valentine's Day from [http://flexmonkey.blogspot.co.uk/](http://flexmonkey.blogspot.co.uk/)
5 |
6 | let layer = CAShapeLayer()
7 | layer.strokeColor = UIColor.redColor().CGColor
8 | layer.fillColor = UIColor(red: 1, green: 0.33, blue: 0.33, alpha: 1).CGColor
9 | layer.lineWidth = 12
10 | layer.lineCap = kCALineCapRound
11 | layer.lineJoin = kCALineCapRound
12 |
13 | let view = UIView(frame: CGRect(x: 0, y: 0, width: 640, height: 640 ))
14 | view.layer.addSublayer(layer)
15 |
16 | XCPlaygroundPage.currentPage.liveView = view
17 |
18 | let points: [CGPoint] = 0.stride(to: M_PI * 2, by: 0.01).map
19 | {
20 | let x = pow(sin($0), 3)
21 | var y = 13 * cos($0)
22 | y -= 5 * cos(2 * $0)
23 | y -= 2 * cos(3 * $0)
24 | y -= cos(4 * $0)
25 | y /= 16
26 |
27 | return CGPoint(x: 320 + (x * 300), y: 280 + (y * -300))
28 | }
29 |
30 | let path = CGPathCreateMutable()
31 |
32 | CGPathAddLines(path, nil, points, points.count)
33 |
34 | layer.path = path
35 |
36 |
--------------------------------------------------------------------------------
/ValentinesSwift.playground/Resources/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlexMonkey/ValentinesSwift/463fc4e32fe37e73f7c879e2031268ac7eb2c08e/ValentinesSwift.playground/Resources/screenshot.png
--------------------------------------------------------------------------------
/ValentinesSwift.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ValentinesSwift.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ValentinesSwift.playground/playground.xcworkspace/xcuserdata/simongladman.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlexMonkey/ValentinesSwift/463fc4e32fe37e73f7c879e2031268ac7eb2c08e/ValentinesSwift.playground/playground.xcworkspace/xcuserdata/simongladman.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/ValentinesSwift.playground/timeline.xctimeline:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------