title: how can i apply mask to PKStroke to achieve dashed line in PKCanvasView?
body: <pre><code>override func viewWillLayoutSubviews() {
      
      guard drawingContainerView.drawing.strokes.last != nil else {
          return
      }
  
      var newLine: [PKStrokePoint] = [PKStrokePoint]()
  
      var index: Int = 0
      let bezierPath: UIBezierPath = UIBezierPath()
      var first = 0
  
      for i in 0..&lt;drawingContainerView.drawing.strokes.last!.path.count {
          if first == 0 {
              bezierPath.move(to: drawingContainerView.drawing.strokes.last!.path[i].location)
              first += 1
          }
  
          if index &lt; 1  {
              index += 1
          } else if index &gt;= 1 &amp;&amp; index &lt; 2 {
              index += 1
              bezierPath.addLine(to: drawingContainerView.drawing.strokes.last!.path[i].location)
          } else if index == 2 {
              index = 0
          }
  
          let point = drawingContainerView.drawing.strokes.last!.path[i]
          newLine.append( PKStrokePoint(location: point.location, timeOffset: point.timeOffset, size: point.size, opacity: point.opacity, force: point.force, azimuth: point.azimuth, altitude: point.altitude))
      }
  
      bezierPath.close()
      let newPath: PKStrokePath = PKStrokePath(controlPoints: newLine, creationDate: Date())
      let maskedStroke: [PKStroke] = [PKStroke(ink: PKInk(.pen, color: .black), path: newPath, transform: drawingContainerView.drawing.strokes.last!.transform, mask: bezierPath)]
  
      drawingContainerView.drawing = PKDrawing(strokes: maskedStroke)
  }
  </code></pre>
  <p>it masks some portion of PKStroke but doesn't work properly and changing patter too doesn't give any idea about how it is working.</p>
  <p>i want to convert drawing to dashed line every time user draws stroke it should be drawn as a dashed line can it be achieved with masking the PKStroke?</p>
  <pre><code>drawingContainerView.drawing.strokes.last?.mask?.setLineDash([5.0,5.0], count: 2, phase: 0)
  </code></pre>
  <p>Or SetLineDash this method can work for this purpose ? i tried it but it didn't gave any results because mask is property is only available after eraser is used.</p>
  <p>any help would be really appreciated thanks.</p>