This file contains 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
require 'formula' | |
class Oclint < Formula | |
homepage 'http://oclint.org' | |
url 'https://github.com/oclint/oclint/releases/download/v0.10.3/oclint-0.10.3-x86_64-darwin-15.5.0.tar.gz' | |
version '0.10.3' | |
sha256 '533b4fdc82664a3d3dede3820fee664c71c3fba2bef4ba096a37ec9c5fc2dae5' | |
def install | |
lib.install Dir['lib/clang'] |
This file contains 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
// | |
// ShadowView.swift | |
// | |
import UIKit | |
@IBDesignable | |
class ShadowView: UIView { | |
@IBInspectable var startAlpha: CGFloat = 90 { |
This file contains 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
// | |
// BaseWebService.swift | |
// | |
import Foundation | |
import UIKit | |
public enum NetworkError: Error { | |
case noData | |
case noGoodResponse |
This file contains 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
enum ResultError: Error { case emptyData } | |
func resultify<T>(_ completion: @escaping (Result<T, Error>) -> Void) -> (T?, Error?) -> Void { | |
return { data, error in | |
if let error = error { | |
completion(.failure(error)) | |
} else if let data = data { | |
completion(.success(data)) | |
} else { | |
completion(.failure(ResultError.emptyData)) |
This file contains 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 | |
import Combine | |
import CoreLocation | |
extension Subscriber { | |
func eraseToAnySubscriber() -> AnySubscriber<Self.Input, Self.Failure> { | |
return AnySubscriber<Input, Failure>.init(receiveSubscription: { sub in | |
self.receive(subscription: sub) | |
}, receiveValue: { value in | |
self.receive(value) |
This file contains 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 Publisher { | |
func catchAndExit(_ completion: @escaping (Self.Failure) -> Void) -> AnyPublisher<Self.Output, Never> { | |
return self | |
.map { output -> Optional<Output> in output } | |
.catch { error -> Just<Optional<Output>> in | |
completion(error) | |
return Just(nil) | |
} | |
.filter { $0 != nil } |
This file contains 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 TrigonometricFunction: CaseIterable { | |
case sinus | |
case cosinus | |
func apply(_ value: Double) -> Double { | |
switch self { | |
case .cosinus: | |
return cos(value) |