Skip to content

Instantly share code, notes, and snippets.

@EvolverSwiftUI
Forked from pallavtrivedi03/AircraftView.swift
Created February 11, 2022 18:13
Show Gist options
  • Save EvolverSwiftUI/5c114c7503b5504c7e36b22cda9a77f7 to your computer and use it in GitHub Desktop.
Save EvolverSwiftUI/5c114c7503b5504c7e36b22cda9a77f7 to your computer and use it in GitHub Desktop.
class AircraftView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
setupView()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
setupView()
}
func setupView() {
let path: UIBezierPath = getPath()
let shape = CAShapeLayer()
shape.path = path.cgPath
shape.lineWidth = 2.0
shape.strokeColor = UIColor.white.cgColor
shape.fillColor = UIColor.clear.cgColor
self.layer.addSublayer(shape)
}
func getPath() -> UIBezierPath {
let path: UIBezierPath = UIBezierPath()
path.move(to: CGPoint(x: 230, y: 520))
path.addLine(to: CGPoint(x: 70, y: 520))
path.addLine(to: CGPoint(x: 60, y: 250))
path.addCurve(to: CGPoint(x: 240, y: 250), controlPoint1: CGPoint(x: 96, y: 16), controlPoint2: CGPoint(x: 204, y: 16))
path.addLine(to: CGPoint(x: 230, y: 520))
path.close()
return path
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment