Skip to content

Instantly share code, notes, and snippets.

@nbhasin2
Created March 13, 2025 05:36
Show Gist options
  • Select an option

  • Save nbhasin2/2604e7c8bc37203bf586fad98217a30a to your computer and use it in GitHub Desktop.

Select an option

Save nbhasin2/2604e7c8bc37203bf586fad98217a30a to your computer and use it in GitHub Desktop.
metal10.swift
struct AnimatedCircleMetalView: UIViewRepresentable {
func makeUIView(context: Context) -> MTKView {
let metalView = MTKView()
metalView.device = MTLCreateSystemDefaultDevice()
metalView.framebufferOnly = false
metalView.colorPixelFormat = .bgra8Unorm
metalView.delegate = context.coordinator
return metalView
}
func updateUIView(_ uiView: MTKView, context: Context) {}
func makeCoordinator() -> AnimatedCircleRenderer {
return AnimatedCircleRenderer()
}
}
struct Step4View: View {
var body: some View {
AnimatedCircleMetalView()
.edgesIgnoringSafeArea(.all)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment