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 getLetterCount(s: String) -> Int { | |
return s.filter { $0 == "a" }.count | |
} | |
func repeatedString(s: String, n: Int) -> Int { | |
let stringCount = s.count | |
let remainder = n % stringCount | |
let multiplier = n / stringCount |
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 toRoman(number: Int) -> String { | |
let romanValues = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"] | |
let arabicValues = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] | |
var romanValue = "" | |
var startingValue = number | |
for (index, romanChar) in romanValues.enumerated() { |
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
// The version of Swift is 4.0. | |
// Get a class name | |
public protocol ClassNameProtocol { | |
static var className: String { get } | |
var className: String { get } | |
} | |
public extension ClassNameProtocol { | |
public static var className: 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 UIKit | |
protocol PropertyStoring { | |
associatedtype T | |
func getAssociatedObject(_ key: UnsafeRawPointer, defaultValue: T) -> T | |
} | |
extension PropertyStoring { | |
func getAssociatedObject(_ key: UnsafeRawPointer, defaultValue: T) -> T { | |
guard let value = objc_getAssociatedObject(self, key) as? T else { |
This file has been truncated, but you can view the full file.
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
AAL ✈️ ABQ | Distance: 8195.183652584217 km | |
AAL ✈️ ABZ | Distance: 730.2386543388001 km | |
AAL ✈️ ACC | Distance: 5777.147943540879 km | |
AAL ✈️ AES | Distance: 644.8547502389752 km | |
AAL ✈️ AGP | Distance: 2507.4437035749943 km | |
AAL ✈️ AKL | Distance: 17510.039331730943 km | |
AAL ✈️ ALA | Distance: 4809.780861544547 km | |
AAL ✈️ ALC | Distance: 2226.079743224819 km | |
AAL ✈️ AMM | Distance: 3457.963091935342 km | |
AAL ✈️ AMS | Distance: 625.1722580574841 km |
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 | |
// | |
// Created by Vitor Venturin Linhalis on 26/11/16. | |
// Copyright © 2016 Vitor Venturin Linhalis. All rights reserved. | |
// | |
import UIKit | |
import Moya | |
import RxSwift |
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
// | |
// Place.swift | |
// | |
// Created by Vitor Venturin Linhalis on 27/11/16. | |
// Copyright © 2016 Vitor Venturin Linhalis. All rights reserved. | |
// | |
import Foundation | |
import Mapper |
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
// | |
// PlaceViewModel.swift | |
// RxPlaces | |
// | |
// Created by Vitor Venturin Linhalis on 17/01/17. | |
// Copyright © 2017 Vitor Venturin Linhalis. All rights reserved. | |
// | |
import UIKit | |
import RxSwift |
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
// | |
// Type.swift | |
// RxPlaces | |
// | |
// Created by Vitor Venturin Linhalis on 12/12/16. | |
// Copyright © 2016 Vitor Venturin Linhalis. All rights reserved. | |
// | |
import Foundation |
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
// | |
// Product | |
// | |
// Created by Vitor Venturin Linhalis. | |
// Copyright © 2016 Vitor Venturin Linhalis. All rights reserved. | |
// | |
import Foundation | |
import Mapper |
NewerOlder