             context.addPath(path)
             context.fillPath(using: .evenOdd)
 
-            if let container = self.chart {
-
-                let axElement = self.createAccessibleElement(withIndex: index,
-                                                             container: container,
-                                                             dataSet: set)
-                { (element) in
-                    element.accessibilityFrame = container.convert(path.boundingBoxOfPath,
-                                                                   to: UIScreen.main.coordinateSpace)
-                    element.accessibilityTraits = UIAccessibilityTraitSelected
-                }
-
-                highlightedAccessibleElements.append(axElement)
-            }
+            let axElement = createAccessibleElement(withIndex: index,
+                                                    container: chart,
+                                                    dataSet: set)
+            { (element) in
+                element.accessibilityFrame = chart.convert(path.boundingBoxOfPath,
+                                                               to: UIScreen.main.coordinateSpace)
+                element.accessibilityTraits = UIAccessibilityTraitSelected
+            }
+
+            highlightedAccessibleElements.append(axElement)
         }
 
         // Prepend selected slices before the already rendered unselected ones.
         // NOTE: - This relies on drawDataSet() being called before drawHighlighted in PieChartView.
-        self.accessiblePieChartElements.insert(contentsOf: highlightedAccessibleElements, at: 1)
+        accessiblePieChartElements.insert(contentsOf: highlightedAccessibleElements, at: 1)
 
         context.restoreGState()
     }

import CoreGraphics

#if !os(OSX)
import UIKit
#endif

open class PieChartRenderer: DataRenderer

                    context.addPath(path)
                    context.fillPath(using: .evenOdd)

                    let axElement = createAccessibleElement(withIndex: j,
                                                            container: chart,
                                                            dataSet: dataSet)
                    { (element) in
                        element.accessibilityFrame = chart.convert(path.boundingBoxOfPath,
                                                                       to: UIScreen.main.coordinateSpace)
                    }

                    accessiblePieChartElements.append(axElement)
                }
            }

