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 drawAndRotateHollowCircle() { | |
// draw | |
let circlePath = UIBezierPath(arcCenter: CGPoint(x: 50, y: 50) , radius: CGFloat(10), startAngle: CGFloat(0), endAngle: CGFloat(Double.pi * 2 * 0.75), clockwise: true) | |
let shapeLayer = CAShapeLayer() | |
shapeLayer.path = circlePath.cgPath | |
if let rect = shapeLayer.path?.boundingBoxOfPath { | |
shapeLayer.frame = rect | |
shapeLayer.bounds = rect | |
} | |
shapeLayer.fillColor = UIColor.clear.cgColor |
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 loadJson(forFilename fileName: String) -> NSDictionary? { | |
if let url = Bundle.main.url(forResource: fileName, withExtension: "json") { | |
if let data = NSData(contentsOf: url) { | |
do { | |
let dictionary = try JSONSerialization.jsonObject(with: data as Data, options: .allowFragments) as? NSDictionary | |
return dictionary | |
} catch { | |
print("Error!! Unable to parse \(fileName).json") |
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
Object.keys(obj).length === 0 && obj.constructor === Object |
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
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// Do any additional setup after loading the view, typically from a nib. | |
self.view.backgroundColor = [UIColor redColor]; | |
NSLog(@"self.view.frame : %@", NSStringFromCGRect(self.view.frame)); | |
NSLog(@"self.view.bounds : %@", NSStringFromCGRect(self.view.bounds)); | |
} | |
- (void)didReceiveMemoryWarning |