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 | |
import MapKit | |
struct ContentView: View { | |
@State var position = MapCameraPosition.region( | |
MKCoordinateRegion( | |
center: CLLocationCoordinate2DMake(35.685175, 139.7528), | |
span: MKCoordinateSpan(latitudeDelta: 0.03, longitudeDelta: 0.03) | |
) | |
) |
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 | |
import MapKit | |
struct MonotoneMap: View { | |
@State var position = MapCameraPosition.region( | |
MKCoordinateRegion( | |
center: CLLocationCoordinate2DMake(35.685175, 139.7528), | |
span: MKCoordinateSpan(latitudeDelta: 0.03, longitudeDelta: 0.03) | |
) | |
) |
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 ShaderView: View { | |
let name: String | |
private let start = Date() | |
var body: some View { | |
let shader = ShaderFunction(library: .default, name: name) | |
TimelineView(.animation) { context in | |
let seconds = context.date.timeIntervalSince(start) |
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 Item: Identifiable, Hashable { | |
var id = UUID() | |
} | |
struct ContentView: View { | |
@State var items = [Item()] | |
var body: some View { |
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: - Model | |
@MainActor | |
@Observable | |
final class Model { | |
var angles: [[Angle]] | |
init(row: Int, column: Int) { | |
angles = (0..<row).map { _ in |
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 ContentView: View { | |
private static let primeNumbers = sieveOfEratosthenes(upTo: 1000000) | |
@State private var scale = 1.0 | |
@State private var start = Date() | |
var body: some View { | |
TimelineView(.animation) { context in | |
let time = context.date.timeIntervalSince(start) |