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 AdaptiveStepper: View { | |
@State var refresh: Bool = false | |
@Binding var selection: Int | |
init(selection: Binding<Int>) { |
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 | |
import Combine | |
struct Response: Codable { | |
var results: [Result] | |
} | |
struct Result: Codable { | |
var trackId: Int | |
var trackName: String |
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 Vector: VectorArithmetic { | |
static func -= (lhs: inout Vector, rhs: Vector) { | |
lhs = lhs - rhs | |
} | |
static func - (lhs: Vector, rhs: Vector) -> Vector { | |
Vector(points: zip(lhs.points, rhs.points).map { $0.0 - $0.1 } ) | |
} |
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 | |
enum Message { | |
/// A message and OK button | |
case information(body: String) | |
/// A message and OK button | |
case warning(body: String) | |
/// A question with YES and NO buttons | |
case confirmation(body: String, action: () -> Void) | |
/// A question about destractive action with `action` and CANCEL buttons |
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
// | |
// ContentView.swift | |
// UnitCoverter | |
// | |
// Created by roblack on 10/12/19. | |
// Copyright © 2019 roblack. All rights reserved. | |
// | |
/// TODO: remove ContentViewUnitExtensions.swift |
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
// Examples | |
UIColor.red.tweaked | |
UIColor.blue.lighter | |
extension UIColor { | |
/// Color gets darker in Light mode and lighter in Dark mode. | |
@objc var tweaked: UIColor { | |
if #available(iOS 13.0, *) { | |
switch UIApplication.userInterfaceStyle { |
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
extension Array { | |
/// Returns the longest possible subsequences of the collection, in order, | |
/// that don't contain elements at indices provided. | |
/// | |
/// The resulting array consists of at most `maxSplits + 1` subsequences. | |
/// Elements that are used to split the sequence are not returned as part of | |
/// any subsequence. | |
/// | |
/// - Parameters: | |
/// - maxSplits: The maximum number of times to split the collection, or |
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
# Refresh local information about remote branches. | |
git remote update --prune | |
# Fetch new remote branches | |
git fetch --all |
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
/* | |
MIT License | |
Copyright © 2017 Dmytro Kholodov | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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
typealias Closure<I, O> = (I) -> O | |
let lambda: Closure<Int, String> = { intValue in | |
return "\(intValue) * \(intValue) = \(intValue*intValue)" | |
} |
NewerOlder