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 | |
// TestMapkit | |
// | |
// Created by Volodymyr Andriienko on 20.05.2021. | |
// Copyright © 2021 VAndrJ. All rights reserved. | |
// | |
import SwiftUI | |
import MapKit |
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
// | |
// Created by Volodymyr Andriienko on 18.05.2021. | |
// Copyright © 2021 VAndrJ. All rights reserved. | |
// | |
#if DEBUG | |
#if canImport(SwiftUI) | |
import SwiftUI | |
@available (iOS 13.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
// | |
// ViewController.swift | |
// StackTest | |
// | |
// Created by Volodymyr Andriienko on 27.04.2021. | |
// | |
// Что здесь происходит: | |
// r - отправка на чтение (первый таймер). | |
// w - отправка на запись (второй таймер). |
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 Foundation | |
infix operator ~>: MultiplicationPrecedence // Here we can create own group | |
// Composes two asynchronous functions | |
func ~> <T, U>( | |
_ first: @escaping (@escaping (Result<T, Error>) -> Void) -> Void, | |
_ second: @escaping (T, @escaping (Result<U, Error>) -> Void) -> Void) -> (@escaping (Result<U, Error>) -> Void | |
) -> Void { | |
return { result in |
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
class Option { | |
final int rawValue; | |
Option(this.rawValue); | |
Option.fromSet(Set<Option> set) : rawValue = set.rawValue; | |
Option.fromList(List<Option> set) : rawValue = set.rawValue; | |
Option operator |(Option option) { |
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
// | |
// NumberAbbreviation.swift | |
// | |
// Created by Volodymyr Andriienko. | |
// | |
import Foundation | |
public struct NumberAbbreviation { | |
// MARK: - Add more if needed, for example: (1_000_000_000, 1_000_000_000, "B"), etc. |
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 Foundation | |
func checkAsync() async -> [String] { | |
(0...10).map({ "\($0)" }) | |
} | |
func checkAsyncAwait() async -> [String] { | |
await checkAsync() | |
} |
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
protocol Applyable {} | |
func with<T, R>(_ lhs: T, _ rhs: (T) throws -> R) rethrows -> R { | |
return try rhs(lhs) | |
} | |
extension Applyable where Self: AnyObject { | |
@discardableResult | |
func apply(_ block: (Self) throws -> Void) rethrows -> Self { |
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
#if DEBUG | |
#if canImport(SwiftUI) | |
import UIKit | |
import SwiftUI | |
@available (iOS 13.0, *) | |
struct UIViewControllerSwiftUIRepresentable: UIViewControllerRepresentable { | |
let controller: UIViewController | |
func makeUIViewController(context: Context) -> UIViewController { |