UIHoleView is the custom UIView that creates holes.
- Add this line to your Cartfile:
github "hlts2/UIHoleView" - Read the official instruction
- imports the
UIHoleViewpackage
import UIHoleView- creates hole and custom view
// defines hole type. this example code is square hole.
lethole=Hole(path:UIBezierPath(rect:CGRect(x:0, y:0, width:200, height:200)),
color:UIColor.clear,
drawer:DrawSquareHole())letholeView=UIHoleView(frame:self.view.bounds) // or let holeView = UIHoleView(holes: [hole])
// sets holes
holeView.setHoles([hole])
// sets background color outside holes
holeView.backgroundColor =UIColor.black.withAlphaComponent(0.5)
// adds holeview into self.view
self.view.addSubview(self.holeView)- Square Hole
lethole=Hole(path:UIBezierPath(rect:CGRect(x:0, y:0, width:200, height:200)),
color:UIColor.clear,
drawer:DrawSquareHole())- Circule Hole
lethole=Hole(path:UIBezierPath(rect:CGRect(x:0, y:0, width:200, height:200)),
color:UIColor.clear,
drawer:DrawCircleHole())- Rounded Corner Hole
lethole=Hole(path:UIBezierPath(roundedRect:CGRect(x:0, y:0, width:200, height:200), cornerRadius:10),
color:UIColor.clear,
drawer:DrawRoundedCornerHole())UIHoleView is released under the MIT license. Go read the LICENSE file for more information.


