Skip to content

Instantly share code, notes, and snippets.

@nemorize
nemorize / korean-subway-station-list.json5
Last active March 28, 2025 04:53
대한민국 국내에 존재하는 지하철역 정보(역명, 지역구, 노선, 위/경도) 목록
[
// =======================================================
// 본 자료는 CC0-1.0 라이선스를 따릅니다.
// https://creativecommons.org/publicdomain/zero/1.0/deed
// 저작권자의 허락을 구하지 않아도 상업적인 목적을 포함한 어떠한 목적으로든
// 자유롭게 복사, 수정, 배포, 실연할 수 있습니다.
// =======================================================
// 모든 정보는 직접 수집하여 정리한 정보입니다.
// 일부 정보가 오기되었거나, 위/경도 좌표가 부정확할 수 있습니다.
// Gist 댓글을 통해 오류를 제보해주세요.
@tigi44
tigi44 / SheetPresentation.swift
Last active February 20, 2024 14:40
Using a UISheetPresentationController on SwiftUI
import SwiftUI
// MARK: - SheetPresentation
public extension View {
func sheetPresentation<SheetView: View>(isPresented: Binding<Bool>, @ViewBuilder sheetView: @escaping () -> SheetView, onDismiss: SheetPresentationController<SheetView>.DefaultClosureType? = nil) -> some View {
self.background(
@StarLard
StarLard / DetentSheet.swift
Last active March 11, 2025 04:44
A simple implementation of an UISheetPresentationController wrapper using SwiftUI
//
// DetentSheet.swift
// StarLardKit
//
// Created by Caleb Friden on 9/28/21.
//
import SwiftUI
// MARK: - Public
@nrubin29
nrubin29 / homebrew_m1.sh
Last active November 24, 2023 11:27
Install Native Homebrew on Apple Silicon M1
# We'll be installing Homebrew in the /opt directory.
cd /opt
# Create a directory for Homebrew. This requires root permissions.
sudo mkdir homebrew
# Make us the owner of the directory so that we no longer require root permissions.
sudo chown -R $(whoami) /opt/homebrew
# Download and unzip Homebrew. This command can be found at https://docs.brew.sh/Installation.
import UIKit
import PlaygroundSupport
protocol WaterfallLayoutDelegate: AnyObject {
    func numberOfColumns() -> Int
    func columnsSize(at indexPath: IndexPath) -> CGSize
    func columnSpace() -> CGFloat
}
final class WaterfallLayoutViewController: UIViewController, UICollectionViewDataSource {
@inso-
inso- / Weak.swift
Created July 7, 2020 14:37
Weak Property Wrapper + Hashable
@propertyWrapper
public struct Weak<Wrapped: AnyObject> {
private weak var value: AnyObject?
public init(_ value: Wrapped? = nil) {
self.value = value
}
public var wrappedValue: Wrapped? {
get { value as? Wrapped }
@NunciosChums
NunciosChums / AuthService.swift
Last active June 8, 2023 04:25
Moya + renewal token when Unauthorized(401)
import Foundation
import Moya
import RxSwift
/// 인증 관련 API
final class AuthService: BaseService<AuthAPI> {
static let shared = AuthService()
private override init() {}
/// 토큰 재발급
//
// CancelBag.swift
// CountriesSwiftUI
//
// Created by Alexey Naumov on 04.04.2020.
// Copyright © 2020 Alexey Naumov. All rights reserved.
//
import Combine
import SwiftUI
@prasadpamidi
prasadpamidi / SegmentedCollectionViewController.swift
Last active October 30, 2022 11:30
Issue with large navigation bar and collection view
import UIKit
class SegmentedControlSupplementaryView: UICollectionReusableView {
let segmentControl = UISegmentedControl(items: ["Item 1", "Items 2", "Items 3"])
static let reuseIdentifier = "segmented-supplementary-reuse-identifier"
override init(frame: CGRect) {
super.init(frame: frame)
self.backgroundColor = .white
@wearhere
wearhere / TextDocumentProxy.swift
Last active March 17, 2025 21:57
A generic implementation of the `UITextDocumentProxy` protocol that should work for anything that conforms to `UIResponder` and `UITextInput`. Useful to put text fields inside custom keyboards and then reuse your keyboard's regular handling logic with this text field. See https://github.com/danielsaidi/KeyboardKit/issues/45 for more info.
//
// documentProxy.swift
// KeyboardKitDemoKeyboard
//
// Created by Jeffrey Wear on 4/28/20.
//
import UIKit
class TextDocumentProxy<TextDocument: UIResponder & UITextInput>: NSObject, UITextDocumentProxy {