This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct InteractiveTiles: View { | |
| let rows = 6 | |
| let columns = 8 | |
| let tileSize: CGFloat = 48 | |
| let spacing: CGFloat = 2 | |
| var gridSize: CGSize { | |
| CGSize( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ModelIO | |
| import MetalKit | |
| public struct ObjectParser { | |
| // mesh contains all the vertices, unordered | |
| public let mesh: MTKMesh | |
| // submesh takes the vertices and with indicies places them in order | |
| public let submeshes: [MTKSubmesh] | |
| public var textures: [MTLTexture] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| public final class SpatialContainerView: UIVisualEffectView { | |
| private lazy var borderLayer: CAShapeLayer = { | |
| let layer = CAShapeLayer() | |
| layer.strokeColor = UIColor.white.withAlphaComponent(0.2).cgColor | |
| layer.fillColor = UIColor.clear.cgColor | |
| layer.lineWidth = borderWidth | |
| return layer | |
| }() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import MetalKit | |
| struct ConstantBuffer<T> { | |
| let length: Int | |
| var data: UnsafeMutablePointer<T> | |
| var position: Int | |
| static var stepSize: Int { | |
| MemoryLayout<T>.stride | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import MetalKit | |
| final class DissolveRenderer: NSObject { | |
| private let device: MTLDevice | |
| private let commandQueue: MTLCommandQueue | |
| private let pipelineState: MTLRenderPipelineState | |
| private var vertexBuffer: MTLBuffer! | |
| private var vertexCount = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct BloomingFirework: View { | |
| @State var time: Double = 0 | |
| let endPoint: CGPoint | |
| let burstColor: Color | |
| let timer = Timer.publish( | |
| every: 1/120, | |
| on: .main, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| extension View where Self: Shape { | |
| func glow( | |
| fill: some ShapeStyle, | |
| lineWidth: Double, | |
| blurRadius: Double = 8.0, | |
| lineCap: CGLineCap = .round | |
| ) -> some View { | |
| self |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| // MARK: - Scroll Behavior | |
| /// A structure that defines a snapping behavior for scroll targets, conforming to `ScrollTargetBehavior`. | |
| struct SnapScrollTargetBehavior: ScrollTargetBehavior { | |
| /// The step value to which the scroll target should snap. | |
| let step: Double | |
| /// Computes the closest multiple of `b` to the given value `a`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| /// Represents Apple's "Hello" greeting. | |
| /// Requires .frame(width: 1212, height: 401) canvas to display correctly | |
| struct HelloShape: Shape { | |
| func path(in rect: CGRect) -> Path { | |
| var shape = Path() | |
| shape.move(to: CGPoint(x: 18, y: 362.78)) | |
| shape.addCurve(to: CGPoint(x: 255.5, y: 72.78), control1: CGPoint(x: 123.36, y: 301.04), control2: CGPoint(x: 240.76, y: 204.38)) |
NewerOlder