Skip to content

Instantly share code, notes, and snippets.

View devxsby's full-sized avatar
💭
Avery

Subin Yoon devxsby

💭
Avery
  • Seoul, Korea
View GitHub Profile
@noah0316
noah0316 / pre-commit
Last active September 3, 2023 10:29
SwiftLint를 Git Hook과 함께 사용하는 방법을 소개합니다 :)
#!/bin/sh
# written by Noah
# 자세한 사용 방법은 https://noah-ios.dev/swiftlint-githooks/ 제 블로그를 참조해주세요!
LINT=$(which swiftlint)
if [[ -e "${LINT}" ]]; then
echo "🚀 SwiftLint 시작..."
echo "🔍 lint 적용 경로: $(pwd)"
count=0
for file_path in $(git ls-files -m --exclude-from=.gitignore | grep ".swift$"); do
import Foundation
import Combine
extension Publisher {
func withUnretained<T: AnyObject>(_ object: T) -> Publishers.CompactMap<Self, (T, Self.Output)> {
compactMap { [weak object] output in
guard let object = object else {
return nil
}
return (object, output)