Skip to content

Instantly share code, notes, and snippets.

View vialyx's full-sized avatar
🎯
Focusing

Maxim Vialyx vialyx

🎯
Focusing
View GitHub Profile
<?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>
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",
//
// ViewController.swift
// AirportTimeTable
//
// Created by Maksim Vialykh on 01.08.2018.
// Copyright © 2018 Vialyx. All rights reserved.
//
import UIKit
typealias FunctionResult = (typleNameArgument: String, typleCountArgument: Int)
func functionName(externalArgumentName internalArgumentName: String = "defaultValue") -> FunctionResult {
return (internalArgumentName, 1)
}
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)
}
func download(from index: Int, with offset: Int) -> [String] {
return ["result"]
}
download(from: 0, with: 10)
func download(from index: Int, with offset: Int = 10) -> [String] {
return ["result"]
}
download(from: 20)
typealias User = String
func getUsers(with ids: UUID...) -> [User] {
return ["Maxim", "Nik"]
}
func update(user: inout User) -> Error? {
user = "Mike"
return nil
}
typealias User = String
func getUsers(with ids: UUID...) -> [User] {
return ["Maxim", "Nik"]
}
var downloadTask: (UUID...) -> [String] = getUsers
downloadTask(UUID())