Skip to content

Instantly share code, notes, and snippets.

View ElonPark's full-sized avatar
📱
 iOS Software Engineer

Elon Park ElonPark

📱
 iOS Software Engineer
View GitHub Profile
@ElonPark
ElonPark / writing.md
Created August 2, 2022 11:39 — forked from longfin/writing.md
엔지니어를 위한 글쓰기

이 글은 Heinrich Hartmann 님이 작성하신 글을 한국어로 번역한 것입니다. 원문은 https://www.heinrichhartmann.com/posts/writing/ 에서 확인하실 수 있습니다.


글쓰기는 큰 조직에서 영향력을 발휘하는 데 중요합니다. 경력 있는 소프트웨어 엔지니어로서의 글쓰기는 직무 범위를 확장하고 경력을 발전시키기 위해 획득해야 하는 가장 중요한 기술입니다.

글쓰기는 어렵습니다. 많은 소프트웨어 엔지니어들이 글쓰기와 씨름하죠. 저도 개인적으로 문학에 대한 관심이 없기 때문에 글쓰기가 자연스럽지 않았습니다.

//: Playground - noun: a place where people can play
import Foundation
import UIKit
import Darwin.os.lock
/**
A threadsafe, non-blocking (on the write side), zero-allocation ring-buffer implementation.
@ElonPark
ElonPark / bindListener.swift
Created July 29, 2021 03:13
bind Listener
// MARK: - Binding
private extension UserListViewController {
func bind(listener: UserListPresentableListener?) {
guard let listener = listener else { return }
bindActions(to: listener)
bindState(from: listener)
}
}
@ElonPark
ElonPark / transformMutation.swift
Last active August 16, 2021 13:18
routing call
// MARK: - transform mutation
func transform(mutation: Observable<Mutation>) -> Observable<Mutation> {
return mutation
.withUnretained(self)
.flatMap { this, mutation -> Observable<Mutation> in
switch mutation {
case .attachUserInformationRIB:
return this.attachUserInformationRIBTransform()
@ElonPark
ElonPark / UserListInteractor.swift
Created July 29, 2021 03:01
UserListInteractor impl Reactor protocol
// MARK: - UserListInteractor
final class UserListInteractor:
PresentableInteractor<UserListPresentable>,
UserListInteractable,
UserListPresentableListener,
Reactor
{
/* ... */
}
@ElonPark
ElonPark / UserListPresentableListener.swift
Created July 29, 2021 02:56
UserListPresentableListener without ReactorKit
// MARK: - UserListPresentableListener
protocol UserListPresentableListener: AnyObject {
typealias Action = UserListPresentableAction
typealias State = UserListPresentableState
func sendAction(_ action: Action)
var state: Observable<State> { get }
var currentState: State { get }
}
@ElonPark
ElonPark / UserListViewController.swift
Created July 29, 2021 02:52
UserListViewController.swift
// MARK: - UserListPresentableAction
enum UserListPresentableAction {
case loadData
case refresh
case loadMore(IndexPath)
case itemSelected(IndexPath)
}
// MARK: - UserListPresentableListener
@ElonPark
ElonPark / UserListInteractor.swift
Last active August 16, 2021 13:18
UserListInteractor
// MARK: - UserListInteractor
final class UserListInteractor:
PresentableInteractor<UserListPresentable>,
UserListInteractable,
UserListPresentableListener,
Reactor
{
// MARK: - Reactor
@ElonPark
ElonPark / ProfileViewReactor.swift
Created July 29, 2021 02:43
ProfileViewReactor
class ProfileViewReactor: Reactor {
// represent user actions
enum Action {
case refreshFollowingStatus(Int)
case follow(Int)
}
// represent state changes
enum Mutation {
case setFollowing(Bool)
@ElonPark
ElonPark / AutoRetry.swift
Created October 16, 2020 05:50 — forked from kean/AutoRetry.swift
Smart Auto Retry using RxSwift
// The MIT License (MIT)
//
// Copyright (c) 2017 Alexander Grebenyuk (github.com/kean).
import Foundation
import RxSwift
import RxCocoa
extension ObservableType {