CALayer equivalent in SwiftUI
In the "Building Custom Views with SwiftUI" talk, they demonstrated that Views and Drawing models/interfaces have essentially been combined under the hood in the framework. Therefore, a View has layer like attributes but built onto the View itself rather than a layer abstraction.
Source: https://developer.apple.com/videos/play/wwdc2019/237/
import SwiftUI
import AVFoundation
struct DrawingView: UIViewRepresentable {
private let view = UIView()
var layer: CALayer? {
view.layer
}
func makeUIView(context: Context) -> UIView {
view
}
func updateUIView(_ uiView: UIView, context: Context) { }
}