Skip to content

Instantly share code, notes, and snippets.

View atimca's full-sized avatar

Maxim Smirnov atimca

View GitHub Profile
custom alert controller - https://github.com/dillidon/Alerts-Pickers
text masks - https://github.com/RedMadRobot/input-mask-ios
@atimca
atimca / AppleSignIn+Rx.swift
Last active April 2, 2020 15:53
Reactive extension for "Sign in with Apple"
import AuthenticationServices
import RxCocoa
import RxSwift
@available(iOS 13.0, *)
private class RxAppleSignInDelegateProxy: DelegateProxy<ASAuthorizationController, ASAuthorizationControllerDelegate> {
private(set) var controller: ASAuthorizationController?
fileprivate var signInSubject = PublishSubject<ASAuthorization>()
@atimca
atimca / Tiny_reactive.swift
Created April 2, 2020 15:50
A tiny realization of a reactive approach.
import PlaygroundSupport
import Foundation
class WeakRef<T> where T: AnyObject {
private(set) weak var value: T?
init(value: T?) {
self.value = value
}
@atimca
atimca / iOS Interview Questions
Created April 14, 2020 14:49
iOS interview questions to interviewer from candidate
Question set for interviews
Developer
Tech
- [ ] How many projects do you have
- [ ] Which architectures approaches do you use
- [ ] Which swift version / legacy objc, c what are you going to do with it.
- [ ] Do you do layout in xibs or in code?
- [ ] What do you think about reactive programming (RxSwift)
func reduce<Result>(_ initialResult: Result, _ nextPartialResult: (Result, Element) -> Result) -> Result
class Store {
func accept(event: Event) {
state = reduce(state: state, event: event)
}
func reduce(state: State, event: Event) -> State {
var state = state
switch event {
case .changeValue(let newValue):
state.value = newValue
protocol Observer {
func stateWasChanged(with newState: State)
}
struct State {
var value: Int?
static func reduce(state: State, event: Event) -> State {
var state = state
switch event {
Twitter(.atimca)
.subscribe(onNext: { newArcticle in
you.read(newArticle)
})
@atimca
atimca / unidirectional.swift
Created May 23, 2020 10:54
Tiny implementation of Unidirectional Architecture with Query based SideEffects.
import Combine
import Foundation
func loadNewsTitles() -> AnyPublisher<[String], Never> {
["title1", "title2"]
.publisher
.delay(for: .microseconds(500), scheduler: DispatchQueue.main)
.collect()
.eraseToAnyPublisher()
}