This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct Siblings { | |
| var sibling1: Int | |
| var sibling2: Int | |
| init(sibling1: Int, sibling2: Int){ | |
| self.sibling1 = sibling1 | |
| self.sibling2 = sibling2 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func rectangles( largeRect: CGRect, count: Int) -> [CGRect] { | |
| if count <= 1 { | |
| CGRect(x: 0, y: 0, width: largeRect.width , height: largeRect.height) | |
| return [] | |
| } else { | |
| for _ in 0...count{ | |
| CGRect(x: 0 + (largeRect.width) * CGFloat(count) , |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func rectangles( largeRect: CGRect, count: Int) -> [CGRect] { | |
| if count <= 1 { | |
| CGRect(x: 0, y: 0, width: largeRect.width , height: largeRect.height) | |
| return [] | |
| } else { | |
| for _ in 0...count{ | |
| CGRect(x: 0 + (largeRect.width) * CGFloat(count) , |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func rectangles( largeRect: CGRect, count: Int) -> [CGRect] { | |
| if count <= 1 { | |
| CGRect(x: 0, y: 0, width: largeRect.width , height: largeRect.height) | |
| return [] | |
| } else { | |
| for _ in 0...count{ | |
| CGRect(x: (0 + (largeRect.width)) * CGFloat(count) , |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func makePlus(at point: CGPoint, dimension: CGFloat, thickness: CGFloat) -> [CGRect] { | |
| let width = dimension | |
| let height = thickness | |
| let first = CGRect( | |
| x: point.x - dimension / 2 , | |
| y: point.y - thickness / 2, | |
| width: width, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func lines(space: Int, context: CGRect, count: Int) -> [CGRect] { | |
| var line = [CGRect]() | |
| for arr in 0..<count { | |
| let lineOne = CGRect(origin:context.minX + CGRect(space) * CGRect(arr), | |
| size: context.height) | |
| let lineOtwo = CGRect(origin:context.width, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let mainLayer = CALayer() | |
| mainLayer.frame = CGRect(x: 0, y: 0, width: 500, height: 500) | |
| mainLayer.backgroundColor = CGColor(red: 100.0/255.0, green: 130.0/255.0, blue: 230.0/255.0, alpha: 1.0) | |
| let layer = CALayer() | |
| layer.frame = CGRect(x: 250, y: 250, width: 100, height: 100) | |
| layer.backgroundColor = CGColor(srgbRed: 10.0, green: 50.0, blue: 10.0, alpha: 100.0) | |
| let oneLayer = CALayer() | |
| oneLayer.frame = CGRect(x: 300, y: 300, width: 50, height: 50) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func bullet1( count: Int) -> [CALayer]{ | |
| let bul = [CALayer]() | |
| // let distance = 10 | |
| for i in 0...count { | |
| let layer = CALayer() | |
| layer.backgroundColor = CGColor(srgbRed: 0.8, green: 0.2, blue: 0.8, alpha: 1.0) | |
| layer.frame = CGRect(x: 250 , | |
| y: 150 + (i * count), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| lass myViewController: UIViewController{ | |
| @IBOutlet weak var viewForLayer: UIView! | |
| var layer: CALayer { | |
| return viewForLayer.layer | |
| } | |
| func setUpLayer() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func isStrangePair(_ str1: String, _ str2: String) -> Bool { | |
| if str1.index(after: str1.startIndex) == str2.index(before: str2.endIndex) | |
| && | |
| str1.index(before: str1.endIndex) == str2.index(after: str2.startIndex) | |
| { | |
| return true |