swift add horizontal line uiview programmatically
// create path
let path = UIBezierPath()
path.move(to: CGPoint(x: 10, y: 10))
path.addLine(to: CGPoint(x: 100, y: 100))
// Create a `CAShapeLayer` that uses that `UIBezierPath`:
let shapeLayer = CAShapeLayer()
shapeLayer.path = path.cgPath
shapeLayer.strokeColor = UIColor.blue.cgColor
shapeLayer.fillColor = UIColor.clear.cgColor
shapeLayer.lineWidth = 3
// Add that `CAShapeLayer` to your view's layer:
view.layer.addSublayer(shapeLayer)
Also in Swift:
- xcode cannot find uiimagepickercontrolleroriginalimage in scope
- uilabel font size swift
- IOS create UIAlertViewController programmatically
- swift open url
- enum from raw value swift
- Library not loaded: @rpath/App.framework/App
- swift thread.sleep
- swift writing to ios logs
- show alert swiftui
- Split a String into an array in Swift
- xcode how to get aspect ratio of device
- swift dispatch after
- swift image button blue
- swift wait 5 seconds
- swift change enum value
- swift how to add a completion block to a function
- swift switch
- how to set the center in view in swift
- sheet swiftui
- swift sort array
- verilog monitor
- set image width and height swiftui
- swift uitableview cell spacing
- how to screen record swift stackoverflow