Get CGPoints from CGMutablePath || Find min and max values from CGMutablePath || iOS find MINX,MINY,MAXX,MAXY from CGMutablePath

Solution: let value = path.getPathElementsPoints() let xArray = value.map(\.x) let yArray = value.map(\.y) let minX = xArray.min()!-drawingPenRectAdj let maxX = xArray.max()!+drawingPenRectAdj let minY = yArray.min()!-drawingPenRectAdj let maxY = yArray.max()!+drawingPenRectAdj print("min x",minX) print("max x",maxX) print("min y",minY) print("max y",maxY) let points = NSMutableArray() points.add(CGPoint(x: minX, y: minY)) points.add(CGPoint(x: maxX, y: maxY)) var covertPoints:[CGPoint] = [] var cgpath:CGMutablePath! = CGMutablePath.init() for i in 0..

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Saved Image in document directory and save path in coredata not able to fetch the image file iOS swift