Skip to content

Instantly share code, notes, and snippets.

View aaronlab's full-sized avatar
🛫

Aaron Lee aaronlab

🛫
View GitHub Profile
@aaronlab
aaronlab / BaseView.swift
Created March 12, 2022 03:33
BaseView.swift
//
// BaseView.swift
//
// Created by Aaron Lee on 2022/03/10.
//
import SnapKit
import Then
import UIKit
class BaseView: UIView {
@aaronlab
aaronlab / BaseTableViewCell.swift
Created March 12, 2022 03:33
BaseTableViewCell.swift
//
// BaseTableViewCell.swift
//
// Created by Aaron Lee on 2022/03/10.
//
import SnapKit
import Then
import UIKit
class BaseTableViewCell: UITableViewCell {
@aaronlab
aaronlab / BaseViewController.swift
Last active March 12, 2022 03:36
BaseViewController.swift
//
// BaseViewController.swift
//
// Created by Aaron Lee on 2022/03/10.
//
import RxCocoa
import RxGesture
import RxSwift
import SnapKit
import Then
@aaronlab
aaronlab / MySocketManager.swift
Created March 8, 2022 02:14 — forked from raxityo/MySocketManager.swift
SocketIO + RxSwift = Awesomeness 🚀
import RxCocoa
import RxSwift
import SocketIO
final class MySocketManager {
struct Relays {
// Custom events:
/// User properties updated
@aaronlab
aaronlab / ApiService.swift
Created December 31, 2021 09:55
Api Service
import Alamofire
import Foundation
import RxSwift
/// APIService
protocol APIService {
func request<T: BaseAPIResponse>(with request: URLRequest) -> Observable<APIResult<T>>
func upload<T: BaseAPIResponse>(with url: URL,
method: Alamofire.HTTPMethod,
@aaronlab
aaronlab / AsyncOperation.swift
Last active December 17, 2021 07:55
AsyncOperation
import Foundation
class AsyncOperation: Operation {
enum State: String {
case ready, executing, finished
fileprivate var keyPath: String {
return "is\(rawValue.capitalized)"
}
}
@aaronlab
aaronlab / UIApplication+Ext.swift
Created November 6, 2021 07:02
Swift Safe Area Inset
//
// UIApplication+Ext.swift
// BottomSheetExample
//
// Created by Aaron Lee on 2021/11/06.
//
import UIKit
extension UIApplication {
@aaronlab
aaronlab / SelectedElements.swift
Created November 4, 2021 05:50
Selected Elements by Selected Indexes
import Foundation
let array = [0, 1, 2, 3, 4, 5, 6, 7, 8]
let selectedIndexes = [0, 1, 3, 5, 7]
extension Array {
subscript (safe index: Int) -> Element? {
return indices ~= index ? self[index] : nil
}
@aaronlab
aaronlab / prepare-commit-msg
Last active October 7, 2021 12:13
prepare-commit-msg
#!/usr/bin/env bash
# .git/hooks/prepare-commit-msg
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop release hotfix)
fi
PROJECT_ID=RPL
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
@aaronlab
aaronlab / Resolution.swift
Created August 16, 2021 11:09
Resolution
import UIKit
struct Resolution {
let width: CGFloat
let height: CGFloat
}
let resolution1 = Resolution(width: 1_920, height: 1_080)
let resolution2 = Resolution(width: 1_080, height: 1_920)