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 | |
open class EventBus { | |
struct Static { | |
static let instance = EventBus() | |
static let queue = DispatchQueue(label: "EventBus", attributes: []) | |
} |
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 | |
import Alamofire | |
protocol ObservableViewModelProtocol { | |
func fetchEmployees() | |
func setError(_ message: String) | |
var employees: Observable<[Employee]> { get set } //1 | |
var errorMessage: Observable<String?> { get set } | |
var error: Observable<Bool> { get set } | |
} |
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
class Observable<T> { | |
var value: T { | |
didSet { | |
listener?(value) | |
} | |
} | |
private var listener: ((T) -> Void)? |
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 | |
import Alamofire | |
public class APIManager { | |
private let manager: Session | |
init(manager: Session = Session.default) { | |
self.manager = manager |
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 | |
class FirstFruitsViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { | |
} |
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
var orientationLock = UIInterfaceOrientationMask.portrait | |
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { | |
return self.orientationLock | |
} | |
struct AppUtility { | |
static func lockOrientation(_ orientation: UIInterfaceOrientationMask) { | |
if let delegate = UIApplication.shared.delegate as? AppDelegate { | |
delegate.orientationLock = orientation |
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
// call Google Places Autocomplete | |
try { | |
AutocompleteFilter autocompleteFilter = new AutocompleteFilter.Builder() | |
.setTypeFilter(Place.TYPE_COUNTRY) | |
.setCountry("GH") | |
.build(); | |
Intent intent = | |
new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY) | |
.setFilter(autocompleteFilter) | |
.build(AddressActivity.this); |
NewerOlder