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 Combine | |
public extension Publishers { | |
final class Pulse<Upstream: Publisher>: Publisher { | |
public typealias Output = Upstream.Output | |
public typealias Failure = Upstream.Failure | |
private let interval: Int | |
private let upstream: Upstream |
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
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
public struct Renderable { | |
private let handle: () -> Void | |
public init(_ handle: @escaping () -> Void) { |
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
// | |
// Transformable.swift | |
// Transformable | |
// | |
// Created by Roshan Nindrai on 10/15/18. | |
// Copyright © 2018 Roshan Nindrai. All rights reserved. | |
// | |
import Foundation | |
import CoreData |
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
// | |
// Morse.swift | |
// Morse | |
// | |
// Created by Roshan Nindrai on 9/30/18. | |
// Copyright © 2018 Roshan Nindrai. All rights reserved. | |
// | |
import Foundation | |
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
#!/usr/bin/env python | |
import subprocess | |
import sys, os | |
from multiprocessing import Pool | |
def pre_req(workspace_path): | |
if '.xcworkspace' in workspace_path and os.path.exists(workspace_path): | |
device_ids = list_device_ids() | |
run_xcuitest(workspace_path, device_ids) |
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
public protocol ComposableCache { | |
associatedtype Key | |
associatedtype Value | |
var getC: (Key) -> Value? { get set } | |
var setC: (Key, Value) -> Void { get set } | |
init(getC: @escaping (Key) -> Value?, setC: @escaping ((Key, Value) -> Void)) |
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
struct MemoryComposableCache<K, V>: ComposableCache { | |
var getC: (K) -> V? | |
var setC: (K, V) -> Void | |
typealias Key = K | |
typealias Value = V | |
} | |
struct DiscComposableCache<K, V>: ComposableCache { | |
var getC: (K) -> V? | |
var setC: (K, V) -> Void |
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 ComposableCache { | |
func get(_ key: Key) -> Value? { | |
return getC(key) | |
} | |
func set(_ key: Key, _ value: Value) { | |
setC(key, 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
public protocol ComposableCache { | |
associatedtype Key | |
associatedtype Value | |
var getC: (Key) -> Value? { get set } | |
var setC: (Key, Value) -> Void { get set } | |
init(getC: @escaping (Key) -> Value?, setC: @escaping ((Key, Value) -> Void)) | |
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
/// Manager class responsible of retriving data | |
final class DataManager { | |
/// Memory Cache responsible for maintaining data in memory | |
var memory = MemoryCache() | |
/// Disc Cache responsible for maintaining data in memory | |
var disc = DiscCache() | |
/// To get value from persistence for a specific key, data is first checked in memory, | |
/// followed by disc. If data isnot found `nil` is returned | |
func get(_ key: key) -> Value? { | |
if let value = memory.get(key) { return value } |
NewerOlder