Repository: airbnb/lottie-ios
File: Sources/Private/Experimental/Layers/ShapeItemLayer.swift (Swift)

Code before:
      lineJoin = stroke.lineJoin.caLineJoin
      lineCap = stroke.lineCap.caLineCap
      // TODO: Support `lineDashPhase` and `lineDashPattern`
    }

    if let shapeTransform = items.first(ShapeTransform.self) {
      // TODO: Need to figure out how to handle keyframing
      transform = CATransform3D.makeTransform(
        anchor: shapeTransform.anchor.keyframes.first!.value.pointValue,
        position: shapeTransform.position.keyframes.first!.value.pointValue,
        scale: shapeTransform.scale.keyframes.first!.value.sizeValue,
        rotation: shapeTransform.rotation.keyframes.first!.value.cgFloatValue,
        skew: shapeTransform.skew.keyframes.first!.value.cgFloatValue,
        skewAxis: shapeTransform.skewAxis.keyframes.first!.value.cgFloatValue)
    }
  }

  required init?(coder _: NSCoder) {
    fatalError("init(coder:) has not been implemented")
  }

  /// Called by CoreAnimation to create a shadow copy of this layer
  /// More details: https://developer.apple.com/documentation/quartzcore/calayer/1410842-init
  override init(layer: Any) {
    guard let layer = layer as? Self else {
      fatalError("init(layer:) incorrectly called with \(type(of: layer))")
    }

    items = layer.items
    super.init(layer: layer)
  }

  // MARK: Private

  private let items: [ShapeItem]

}

// MARK: AnimationLayer

extension ShapeItemLayer: AnimationLayer {
  func animations(context _: LayerAnimationContext) -> [CAPropertyAnimation] {
    [] // TODO: implement
  }
}

// MARK: - [ShapeItem] helpers

extension Array where Element == ShapeItem {
  /// The CGPath formed by combining all of the path-providing `ShapeItem`s in this set of shape items
  var path: CGPath {

Review comment (bug):
```suggestion
      fatalError("\(Self).init(layer:) incorrectly called with \(type(of: layer))")
```

Code after:
      lineJoin = stroke.lineJoin.caLineJoin
      lineCap = stroke.lineCap.caLineCap
      // TODO: Support `lineDashPhase` and `lineDashPattern`
    }

    if let shapeTransform = items.first(ShapeTransform.self) {
      // TODO: Need to figure out how to handle keyframing
      transform = CATransform3D.makeTransform(
        anchor: shapeTransform.anchor.keyframes.first!.value.pointValue,
        position: shapeTransform.position.keyframes.first!.value.pointValue,
        scale: shapeTransform.scale.keyframes.first!.value.sizeValue,
        rotation: shapeTransform.rotation.keyframes.first!.value.cgFloatValue,
        skew: shapeTransform.skew.keyframes.first!.value.cgFloatValue,
        skewAxis: shapeTransform.skewAxis.keyframes.first!.value.cgFloatValue)
    }
  }

  required init?(coder _: NSCoder) {
    fatalError("init(coder:) has not been implemented")
  }

  /// Called by CoreAnimation to create a shadow copy of this layer
  /// More details: https://developer.apple.com/documentation/quartzcore/calayer/1410842-init
  override init(layer: Any) {
    guard let layer = layer as? Self else {
      fatalError("\(Self.self).init(layer:) incorrectly called with \(type(of: layer))")
    }

    items = layer.items
    super.init(layer: layer)
  }

  // MARK: Private

  private let items: [ShapeItem]

}

// MARK: AnimationLayer

extension ShapeItemLayer: AnimationLayer {
  func animations(context _: LayerAnimationContext) -> [CAPropertyAnimation] {
    [] // TODO: implement
  }
}

// MARK: - [ShapeItem] helpers

extension Array where Element == ShapeItem {
  /// The CGPath formed by combining all of the path-providing `ShapeItem`s in this set of shape items
  var path: CGPath {