Skip to content

Instantly share code, notes, and snippets.

View vialyx's full-sized avatar
🎯
Focusing

Maxim Vialyx vialyx

🎯
Focusing
View GitHub Profile
typealias User = String
func getUsers(with ids: UUID...) -> [User] {
return ["Maxim", "Nik"]
}
func download(from index: Int, with offset: Int = 10) -> [String] {
return ["result"]
}
download(from: 20)
func download(from index: Int, with offset: Int) -> [String] {
return ["result"]
}
download(from: 0, with: 10)
typealias ItemsAndErrorResult = (items: [String], error: Error?)
func download(from index: Int, with offset: Int) -> ItemsAndErrorResult {
guard index < 100 else {
return ([], NSError(domain: "com.vialyx.course", code: -987, userInfo: nil))
}
let items = Array(repeating: "result_\(index)", count: offset)
return (items, nil)
}
typealias FunctionResult = (typleNameArgument: String, typleCountArgument: Int)
func functionName(externalArgumentName internalArgumentName: String = "defaultValue") -> FunctionResult {
return (internalArgumentName, 1)
}
//
// ViewController.swift
// AirportTimeTable
//
// Created by Maksim Vialykh on 01.08.2018.
// Copyright © 2018 Vialyx. All rights reserved.
//
import UIKit
import Vapor
/// Register your application's routes here.
public func routes(_ router: Router) throws {
router.get("departure") { request in
return """
[
{
"company_name": "Belavia",
"departure_time": "05:00",
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Kind</key>
<string>Xcode.IDEKit.TextSubstitutionFileTemplateKind</string>
<key>Platforms</key>
<array>
<string>com.apple.platform.iphoneos</string>
</array>
override var intrinsicContentSize: CGSize {
return CGSize(width: cornerRadius * 4, height: cornerRadius * 2)
}
let container = RoundContainer()
container.backgroundColor = .blue
container.cornerRadius = 40
container.translatesAutoresizingMaskIntoConstraints = false
roundContainer = container
view.addSubview(container)
NSLayoutConstraint.activate([
container.centerXAnchor.constraint(equalTo: view.centerXAnchor),