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 | |
// https://developer.apple.com/documentation/swiftui/lazyvgrid | |
struct ContentView: View { | |
var columns: [GridItem] = | |
Array(repeating: .init(.flexible()), count: 4) | |
var body: some View { | |
ScrollView { |
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 GridPicker<Data, Label, Content>: View where Data: RandomAccessCollection, Data.Index == Int, Data.Element: Hashable, Data.Element: Identifiable, Label: View, Content: View { | |
@Environment(\.gridPickerStyle) private var pickerStyle | |
typealias SelectionValue = Data.Element | |
let data: Data | |
let selection: Binding<SelectionValue> |
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
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
/// AutoLayout DSL extended from https://www.swiftbysundell.com/posts/building-dsls-in-swift | |
public protocol LayoutAnchor { | |
func constraint(equalTo anchor: Self, | |
constant: CGFloat) -> NSLayoutConstraint |
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
/// Queue player | |
struct Player { | |
/// The player status | |
/// | |
/// - idle: before play | |
/// - waiting: means it is waiting for loading asset | |
/// - playing: now playing | |
/// - paused: paused | |
/// - stopped: end play |