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 { | |
@EnvironmentObject var dependencyContainer: DependencyContainer | |
@StateObject var viewModel = ContentViewModel() | |
var body: some View { | |
VStack(alignment: .center) { | |
VStack(spacing: 32) { | |
Text(viewModel.refreshTimestamp) |
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 ColorContrastRatio | |
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
VStack { | |
Text("Luminance for red color").padding() | |
Rectangle() | |
.frame(width: 50, height: 50) | |
.fixedSize() |
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 UIKit | |
/* | |
Contrast ratio is calculated using the proceedure here: | |
https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-procedure | |
*/ | |
public extension UIColor { | |
/// Relative luminance of the color. | |
var relativeLuminance: CGFloat { |
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
// swift-tools-version:5.3 | |
// The swift-tools-version declares the minimum version of Swift required to build this package. | |
import PackageDescription | |
let package = Package( | |
name: "ColorContrastRatio", | |
platforms: [ | |
.iOS(.v13), .macOS(.v10_15) | |
], |
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 ButtonKit | |
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
Button("Title", action: tap).buttonStyle(FunkyButtonStyle()) | |
} | |
func tap() { | |
print("Tapped") |
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
// swift-tools-version:5.3 | |
import PackageDescription | |
let package = Package( | |
name: "ButtonKit", | |
platforms: [ | |
.iOS(.v14), .macOS(.v10_15) | |
], | |
products: [ |
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
# Rename local branches | |
git branch -m new_name | |
# Edit last 3 commits | |
# Note: rewrites history, therefore use it for local branches or for remote branches which can be force pushed | |
git rebase -i HEAD~3 |
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
enum Fruit: String, CaseIterable { | |
case apple, orange, pear | |
} | |
func makeFruitPicker() -> some View { | |
Picker("Fruits", selection: $selectedFruit) { | |
ForEach(Fruit.allCases, id: \.rawValue) { fruit in | |
Text(fruit.rawValue).tag(fruit) | |
} | |
}.pickerStyle(SegmentedPickerStyle()) |
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
@State private var selectedPlanet = "" | |
let planets = ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Neptune", "Uranus"] | |
func makePlanetPicker() -> some View { | |
Picker("Planets", selection: $selectedPlanet) { | |
ForEach(planets, id: \.self) { planet in | |
Text(planet) | |
}.navigationBarTitle("Planets") | |
} | |
} |