First of all, it looks like you should use MDRotatingPieChart.swift from the MDRotatingPieChart-Example folder , since it is much more modern. However, it contains the error you described, and the source of the error, apparently, is that the original developer does not know the difference between frame and bounds , which correspond to the UIView doc :
The geometry of each view is determined by its frame and bounds properties. The frame property determines the beginning and dimensions of the view in the coordinate system of its supervisor. The bounds property determines the internal dimensions of a view when it sees them, and is used almost exclusively in custom drawing code.
So, to fix the problem, you can find the following line in createSlice
mask.frame = self.frame
and replace it with
mask.frame = self.bounds
PS There is a line in your code
pieChart = MDRotatingPieChart(frame: CGRect(x: 30, y: 30, width: view.frame.width + 30 , height: view.frame.width + 30 ))
what is suspicious. You almost never want the width or height for the child to be larger than the corresponding parent dimension. You probably want
pieChart = MDRotatingPieChart(frame: CGRect(x: 30, y: 30, width: view.frame.width - 30 , height: view.frame.width - 30 ))
or even (if you need symmetric fields for both X and Y)
pieChart = MDRotatingPieChart(frame: CGRect(x: 30, y: 30, width: view.frame.width - 2*30 , height: view.frame.width - 2*30 ))
instead.