- Le client s'appelle DOE
- Les environnements possibles sont dev et release
Configuration principale pour le projet:
import Foundation | |
/// #Do class - Or how to transform DispatchQueue-escaping-weakable stuff on pointer into a more readable usage | |
/// TL;DR - Usage | |
// In ViewModel/Interactor | |
Do.bg(on: self) { this in | |
this.doSomeWSCalls() |
let otherTableau: Array<(Int, String)> = [(1,"a"),(2,"b"),(3,"c"),(4,"d")] | |
let mean = otherTableau.map { tuple -> Int in | |
return tuple.0 | |
} | |
/* | |
On peut aussi écrire le map de mean de cette facon, pour raccourcir l'écriture | |
"$0" est "le premier argument" |
extension Numeric where Self: Comparable /* NORMALIZER */ { | |
/// normalize the current value between a min and a max interval, by adding optionaly a value. this works just like the compass normalization. for Ex, 357°, by adding +4 became 1° for [0 - 360] interval | |
/// | |
/// - Parameters: | |
/// - value: the value to add | |
/// - min: the minimum interval | |
/// - max: the maximum interval | |
/// - Returns: the new, transformed and normalized value |
extension CGImage { | |
var brightness: Double { | |
get { | |
let imageData = self.dataProvider?.data | |
let ptr = CFDataGetBytePtr(imageData) | |
var x = 0 | |
var result: Double = 0 | |
for _ in 0..<self.height { | |
for _ in 0..<self.width { | |
let r = ptr![0] |
enum Restaurant: RawRepresentable { | |
typealias RawValue = Array<Int> | |
case toto | |
case tata | |
var rawValue: Array<Int> { | |
switch self { | |
case .tata: |
/// **From App to SDK(system)** | |
/// | |
/// Give informations thanks to user interaction | |
/// Called by the app, when user interacts about routing or location stuff | |
/// | |
/// `[App].call(sdkSystemDatasource.function(params))` | |
protocol PositionHelperDatasource { | |
/// Call this datasourced-function when a routing or a re-position is asked by the user |
/** | |
* Copyright (c) 2017 Razeware LLC | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |
extension NSObject { | |
private enum SetValuableErrorType: Error, CustomStringConvertible { | |
case unknown(key: String, type: NSObject) | |
var description: String { | |
switch self { | |
case .unknown(key: let k, type: let t): | |
return "Unknown parameters \(k) for object typped \(String(describing:t))" | |
} |
import Foundation | |
import Result | |
import RxSwift | |
enum ResponseErrorType: Error, CustomStringConvertible { | |
case technical | |
case notFound | |
case other(message: Array<String>) | |