Skip to content

Instantly share code, notes, and snippets.

View robertofrontado's full-sized avatar
🐶
Working from home

Roberto Frontado robertofrontado

🐶
Working from home
View GitHub Profile
import Foundation
public class SwiftDI {
public static let `default` = SwiftDI()
private var dependencies = [String: Resolver]()
public static func configure(container: SwiftDI = .default, _ config: (SwiftDI) -> Void) {
config(container)
@robertofrontado
robertofrontado / ClassWithoutDependencyInjection.swift
Last active April 13, 2020 15:02
ClassWithoutDependencyInjection
class Repository {}
class ViewModel {
let repository: Repository
init() {
self.repository = Repository()
}
}
@robertofrontado
robertofrontado / ClassWithDependencyInjection.swift
Last active April 13, 2020 15:02
DependencyInjectionExample
class Repository {}
class ViewModel {
let repository: Repository
init(repository: Repository) {
self.repository = repository
}
}
@robertofrontado
robertofrontado / README.md
Created July 2, 2017 16:46 — forked from boopathi/README.md
Creating a Swift-ReactNative project

Settings

  1. Create a project in XCode with the default settings
    • iOS > Application > Single View Application
    • Language: Swift
  2. Under project General settings, add ReactKit to Linked Framework and Libraries
    • + > Add Other... and choose /path/to/react-native/ReactKit/ReactKit.xcodeproj
  3. Now ReactKit would have been imported. Link it by choosing it from the list.
    • + > lib.ReactKit.a
  4. Under project Build Settings,
@robertofrontado
robertofrontado / RxKeyboard
Created May 17, 2016 17:26
Useful Rx tool to works with the Keyboard states in iOS
//
// RxKeyboard.swift
// RxTools
//
// Created by Roberto Frontado on 5/16/16.
// Copyright © 2016 Roberto Frontado. All rights reserved.
//
import RxSwift
@robertofrontado
robertofrontado / RxMoyaProvider.swift
Created March 10, 2016 15:41
Returning Observable from request on a background thread
import Foundation
import RxSwift
/// Subclass of MoyaProvider that returns Observable instances when requests are made. Much better than using completion closures.
public class RxMoyaProvider<Target where Target: TargetType>: MoyaProvider<Target> {
/// Initializes a reactive provider.
override public init(endpointClosure: EndpointClosure = MoyaProvider.DefaultEndpointMapping,
requestClosure: RequestClosure = MoyaProvider.DefaultRequestMapping,
stubClosure: StubClosure = MoyaProvider.NeverStub,
manager: Manager = RxMoyaProvider<Target>.DefaultAlamofireManager(),