Skip to content

Instantly share code, notes, and snippets.

Avatar

颜风 ios122

View GitHub Profile
@mayoff
mayoff / Arrow.swift
Last active Jun 8, 2020
UIBezierPath category to create an arrow (now with a Swift version!)
View Arrow.swift
// Swift 2.2 syntax / API
import UIKit
extension UIBezierPath {
class func arrow(from start: CGPoint, to end: CGPoint, tailWidth: CGFloat, headWidth: CGFloat, headLength: CGFloat) -> Self {
let length = hypot(end.x - start.x, end.y - start.y)
let tailLength = length - headLength
You can’t perform that action at this time.