Blog 2020/5/7
<- previous | index | next ->
EDIT 2024/12/1: I updated a few of these commands to work with qemu 9.x.
| import SwiftUI | |
| import PlaygroundSupport | |
| struct Desktop: View { | |
| var body: some View { | |
| ZStack { | |
| // Image(uiImage: #imageLiteral(resourceName: "IMG_6281.JPG")) | |
| Color(UIColor.systemBlue) | |
| macOS() | |
| } |
| import Foundation | |
| enum LexingError: Error, Equatable { | |
| case syntaxError(String) | |
| case unexpectedEOF | |
| } | |
| enum ParsingError: Error { | |
| case expected(String) | |
| case unexpectedToken(Token) |
| // Run any SwiftUI view as a Mac app. | |
| import Cocoa | |
| import SwiftUI | |
| NSApplication.shared.run { | |
| VStack { | |
| Text("Hello, World") | |
| .padding() | |
| .background(Capsule().fill(Color.blue)) |
Blog 2020/5/7
<- previous | index | next ->
EDIT 2024/12/1: I updated a few of these commands to work with qemu 9.x.
| /** | |
| * PreviewDevice+ListOfPads.swift | |
| * Copyright (c) Thiago Holanda 2020 | |
| * https://twitter.com/tholanda | |
| * | |
| * MIT license | |
| */ | |
| import SwiftUI |
| protocol KeyPathUpdatable {} | |
| extension KeyPathUpdatable { | |
| func updating<LeafType>(_ keyPath: WritableKeyPath<Self, LeafType>, to value: LeafType) -> Self { | |
| var copy = self | |
| copy[keyPath: keyPath] = value | |
| return copy | |
| } | |
| } |
| // | |
| // BottomSheetView.swift | |
| // | |
| // Created by Majid Jabrayilov | |
| // Copyright © 2019 Majid Jabrayilov. All rights reserved. | |
| // | |
| import SwiftUI | |
| fileprivate enum Constants { | |
| static let radius: CGFloat = 16 |
| [alias] | |
| k = !gitk --all & | |
| dismiss = reset HEAD --hard | |
| rollback = reset --soft HEAD~1 | |
| unstage = reset HEAD -- | |
| undo = checkout -- | |
| redo = commit --amend --no-edit | |
| sane = remote prune origin | |
| send = push origin $(git rev-parse --abbrev-ref HEAD) | |
| l = log --graph --pretty=format:'%C(yellow)%h%Creset %Cgreen%cr %C(bold blue)%an%Creset - %s%C(red)%d%Creset' --abbrev-commit --max-count=30 |
| // The SwiftUI Lab | |
| // Website: https://swiftui-lab.com | |
| // Article: https://swiftui-lab.com/alignment-guides | |
| import SwiftUI | |
| class Model: ObservableObject { | |
| @Published var minimumContainer = true | |
| @Published var extendedTouchBar = false | |
| @Published var twoPhases = true |