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
// | |
// CustomPicker.swift | |
// | |
// Created by T Brennan on 27/3/21. | |
// | |
import SwiftUI | |
struct ContentView: View { | |
@State private var selection: Int? = 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 AccessibleView: View { | |
@ScaledMetricCustom(relativeTo: .title) var someSize: CGFloat = 100 | |
@ScaledFont(customFontName: "TimesNewRomanPS-BoldMT", size: 18, relativeTo: .body) var bodyFont | |
var body: some View { | |
VStack { | |
Rectangle() | |
.frame(width: someSize, height: someSize) |
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 | |
@ViewBuilder | |
func `ifLet`<T, Content: View>(_ optional: T?, @ViewBuilder builder: ((T) -> Content)) -> some View { | |
optional.map(builder) | |
} | |
@ViewBuilder | |
func `ifNotLet`<T, Content: View>(_ optional: T?, @ViewBuilder builder: (() -> Content)) -> some View { | |
if optional == nil { |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |