This file contains 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
precedencegroup AssociativeComparisonPrecedence { | |
associativity: left | |
higherThan: ComparisonPrecedence | |
lowerThan: NilCoalescingPrecedence | |
} | |
infix operator <: AssociativeComparisonPrecedence | |
infix operator <=: AssociativeComparisonPrecedence | |
public func < <V: Comparable>(lhs: V, rhs: V) -> (Bool, V) { |
This file contains 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 SmashableView: NSViewRepresentable { | |
typealias NSViewType = _SmashableNSView | |
let text: String | |
class _SmashableNSView: NSView { | |
This file contains 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
enum Parked {} | |
enum Driving {} | |
enum Gaming {} | |
private class EngineSystem { | |
static var shared = EngineSystem() | |
private init() {} | |
func start() {/**/} | |
func accelerate() { /* Uses gas pedal input to accelerate the real car */ } |
This file contains 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 HeaderView: View { | |
var body: some View { | |
HStack { | |
Image(systemName: "info.circle.fill") | |
.resizable() | |
.frame(width: 12, height: 12) | |
Text("Section Header") | |
.font(.system(size: 13)) |
This file contains 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
// Adapted from Hacking with SwiftUI, credit to Paul Hudson (@twostraws). | |
// https://www.hackingwithswift.com/books/ios-swiftui/animating-gestures | |
import SwiftUI | |
struct ContentView: View { | |
@State private var dragAmount = CGSize.zero | |
var body: some View { | |
RoundedRectangle(cornerRadius: 10) |
This file contains 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 SwiftData | |
// TODO: Make this animatable shape | |
struct Polygon: Shape { | |
var edges: Int | |
var pathUpdated: (Path) -> Void | |
var vertexUpdated:([CGPoint]) -> Void |
This file contains 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 | |
/// このプロトコルで画面遷移のインターフェースを共通化 | |
protocol Coordinator { | |
func start() | |
} | |
/// 初期起動経路を管理するクラス | |
final class AppCoordinator: Coordinator { | |
// プロパティとしてUIWindowとUINavigationControllerを保持する |
This file contains 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
enum DataState<V, E: Error> { | |
case idle | |
case initialLoading case reLoading (V) | |
case retryLoading (E) | |
case success (V) | |
case failure(E) | |
case paging (V) | |
case pagingFailure(V, E) | |
} |
This file contains 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 { | |
var body: some View { | |
VStack { | |
OpacityIcons(content: OpacityIcon1.init) | |
OpacityIcons(content: OpacityIcon2.init) | |
} | |
.padding() | |
} |