Community코딩 & 개발github.com

clerk/clerk-swift

Clerk 인증을 네이티브 Swift 및 iOS 앱에 구현합니다. ClerkKit 및 ClerkKitUI의 소스 기반 패턴을 사용하여 미리 빌드된 AuthView 또는 커스텀 네이티브 흐름을 지원합니다. Expo나 React Native 프로젝트에는 사용하지 마세요.

clerk-swift란 무엇인가요?

이 스킬은 Swift 및 iOS 앱 개발자가 Clerk 인증을 손쉽게 통합할 수 있도록 설계되었습니다. ClerkKit과 ClerkKitUI의 소스 기반 패턴을 활용하여 미리 만들어진 AuthView UI 구성 요소로 빠른 인증 흐름을 구현하거나, 완전히 커스텀한 네이티브 인증 흐름을 구축할 수 있습니다. 이는 주로 네이티브 SwiftUI 또는 UIKit 기반 프로젝트를 대상으로 하며, Expo나 React Native와 같은 크로스 플랫폼 프레임워크에서는 사용할 수 없습니다. 개발자는 제공된 소스 파일을 참고하여 이메일/비밀번호, 소셜 로그인, 매직 링크 등 다양한 인증 방식을 앱에 적용할 수 있습니다. 또한, 자동 생성된 UI 템플릿을 통해 빠르게 프로토타이핑하거나, 인증 관련 상태 관리 및 라우팅 로직을 커스터마이징할 수 있습니다. 이 스킬은 최신 iOS 플랫폼 및 Swift Package Manager와의 호환성을 보장하며, 공식 Clerk 문서와 함께 사용될 때 가장 효과적입니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/clerk/skills/tree/main/skills/clerk-swift

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

clerk-swift은(는) 무엇을 하나요?

네이티브 Swift 및 iOS 앱에 Clerk 인증을 구현합니다. ClerkKit 및 ClerkKitUI의 소스 기반 패턴을 사용하여 미리 빌드된 AuthView 또는 커스텀 네이티브 흐름을 지원합니다. Expo나 React Native 프로젝트에는 사용하지 마세요.

개요

이 스킬은 네이티브 Swift 및 iOS 애플리케이션에서 Clerk 인증을 설정하기 위한 가이드를 제공합니다. 다음을 포함합니다:

  • ClerkKit을 사용한 기본 인증 구성
  • ClerkKitUI를 사용한 미리 빌드된 인증 UI 통합
  • 완전히 커스텀한 네이티브 인증 흐름 구현
  • 인증 상태 관리 및 라우팅

전제 조건

  • Swift 5.7+
  • iOS 15+
  • Xcode 14+
  • Swift Package Manager
  • Clerk 계정 및 프론트엔드 API 키

설치

Package.swift에 ClerkKit 및 ClerkKitUI를 추가하거나 Xcode를 통해 추가합니다.

// Package.swift
dependencies: [
    .package(url: "https://github.com/clerkinc/clerk-swift.git", from: "2.0.0")
]

Xcode의 경우: 파일 > 패키지 추가... 로 이동하여 저장소 URL을 입력합니다.

사용 방법

1. 인증 구성

Clerk.shared 인스턴스를 앱 시작 시 구성합니다.

import ClerkKit

@main
struct MyApp: App {
    init() {
        Clerk.shared.configure(with: "your_frontend_api_key")
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

2. 미리 빌드된 인증 UI (ClerkKitUI)

가장 빠른 방법은 AuthView를 사용하는 것입니다.

import SwiftUI
import ClerkKitUI

struct ContentView: View {
    var body: some View {
        AuthView()
    }
}

3. 커스텀 인증 흐름

더 많은 제어가 필요하면 ClerkKit의 저수준 API를 사용합니다.

import ClerkKit

class AuthenticationViewModel: ObservableObject {
    @Published var isAuthenticated = false

    func signIn(email: String, password: String) async {
        do {
            let user = try await Clerk.shared.signIn(email: email, password: password)
            isAuthenticated = true
        } catch {
            // 에러 처리
        }
    }
}

주요 구성 요소

구성 요소설명
Clerk전역 인증 관리자
AuthView미리 빌드된 인증 UI (ClerkKitUI)
ClerkClient저수준 API 클라이언트
User인증된 사용자 객체

중요한 고려 사항

  • Expo 또는 React Native 프로젝트에는 절대 사용하지 마십시오. 대신 clerk/expo 또는 clerk/react-native 스킬을 사용하세요.
  • 앱이 백그라운드에 있을 때 인증 세션을 유지하려면 keychain 저장소를 활성화하세요.
  • 사용자 정의 UI의 경우 ClerkKit의 AuthenticationDelegate 프로토콜을 구현하세요.

문제 해결

  • "Invalid frontend API key": configure에 전달된 API 키가 올바른지 확인하세요.
  • 로그인/회원가입 화면이 나타나지 않음: AuthView가 앱의 루트 뷰 계층에 올바르게 배치되었는지 확인하세요.
  • 네트워크 오류: 앱이 인터넷에 연결되어 있고 Apple의 앱 전송 보안 정책이 올바르게 설정되었는지 확인하세요.

추가 문서

더 자세한 정보는 공식 Clerk Swift 문서를 참조하세요.

Individual skills in this repo

This repo contains 19 individual skills — each has its own dedicated page.

clerk/clerk

Clerk authentication router. Use when user asks about adding authentication, setting up Clerk, custom sign-in flows, Swift or native iOS auth, native Android auth, Next.js patterns, React patterns, Vue patterns, Nuxt patterns, Astro patterns, TanStack Start patterns, Expo patterns, React Router patterns, Chrome Extension patterns, organizations, billing, subscriptions, payments, pricing, plans, seat-based pricing, feature entitlements, syncing users, or testing. Automatically routes to the specific skill based on their task.

clerk/clerk-android

Implement Clerk authentication for native Android apps using Kotlin and Jetpack Compose with clerk-android source-guided patterns. Use for prebuilt AuthView/UserButton or custom API-driven auth flows. Do not use for Expo or React Native projects.

clerk/clerk-astro-patterns

Astro patterns with Clerk — middleware, SSR pages, island components, API routes, static vs SSR rendering. Triggers on: astro clerk, clerk astro middleware, astro protected page, clerk island component, astro API route auth, clerk astro SSR.

clerk/clerk-backend-api

Clerk Backend REST API explorer and executor. Browse tags, inspect endpoint schemas, and execute authenticated requests. Use when listing users, managing organizations, or calling any Clerk API endpoint.

clerk/clerk-billing

Clerk Billing for subscription management - render Clerk's PricingTable and in-app checkout drawer, configure subscription plans, seat-limit plans for B2B, feature entitlements with has(), and billing webhooks. Use for SaaS monetization, plan gating, checkout flows, trials, invoicing, and subscription lifecycle management.

clerk/clerk-chrome-extension-patterns

Chrome Extension auth with @clerk/chrome-extension -- popup/sidepanel setup, syncHost for OAuth/SAML via web app, createClerkClient for service workers and headless extensions, stable CRX ID. Triggers on: Chrome extension auth, Plasmo clerk, popup sign-in, syncHost, background service worker token, createClerkClient, headless extension.

clerk/clerk-custom-ui

Custom authentication flows and component appearance - hooks (useSignIn, useSignUp), themes, colors, fonts, CSS. Use for custom sign-in/sign-up flows, appearance styling, visual customization, branding.

clerk/clerk-expo

Implement Clerk authentication for Expo and React Native apps using @clerk/expo source-guided patterns. Use for prebuilt AuthView/UserButton or custom hook-driven auth flows. Do not use for native iOS/Swift, native Android/Kotlin, or web framework projects.

clerk/clerk-expo-patterns

Expo / React Native patterns with Clerk — SecureStore token cache, OAuth deep linking, useAuth in native, Expo Router protected routes, push notifications with user context. Triggers on: expo clerk, clerk react native, SecureStore token cache, expo router auth, OAuth deep link clerk, mobile auth clerk.

clerk/clerk-nextjs-patterns

Advanced Next.js patterns - middleware, Server Actions, caching with Clerk.

clerk/clerk-nuxt-patterns

Nuxt 3 auth patterns with @clerk/nuxt - middleware, composables, server API routes, SSR. Triggers on: Nuxt auth, useAuth composable, clerkMiddleware Nuxt, server API Clerk, Nuxt route protection.

clerk/clerk-orgs

Clerk Organizations for B2B SaaS - create multi-tenant apps with org switching, role-based access, verified domains, and enterprise SSO. Use for team workspaces, RBAC, org-based routing, member management.

clerk/clerk-react-patterns

React SPA auth patterns with @clerk/react for Vite/CRA - ClerkProvider setup, useAuth/useUser/useClerk hooks, React Router protected routes, custom sign-in flows. Triggers on: Vite Clerk setup, React Router auth, useAuth hook, protected route, custom sign-in form React.

clerk/clerk-react-router-patterns

React Router v7 patterns with Clerk — rootAuthLoader, getAuth in loaders, clerkMiddleware, protected routes, SSR user data, org switching. Triggers on: react-router auth, rootAuthLoader, getAuth loader, react-router protected route, loader authentication, SSR auth react-router.

clerk/clerk-setup

Add Clerk authentication to any project by following the official quickstart guides.

clerk/clerk-tanstack-patterns

TanStack React Start auth patterns with @clerk/tanstack-react-start - createServerFn, beforeLoad guards, loaders, Vinxi server. Triggers on: TanStack auth, createServerFn clerk, beforeLoad protection, TanStack Start middleware.

clerk/clerk-testing

E2E testing for Clerk apps. Use with Playwright or Cypress for auth flow tests.

clerk/clerk-vue-patterns

Vue 3 patterns with Clerk — composables (useAuth, useUser, useClerk, useOrganization), Vue Router guards, Pinia auth store integration. Triggers on: vue clerk, useAuth vue, clerk composables, vue router clerk guard, pinia auth clerk. For Nuxt, use clerk-nuxt-patterns instead.

clerk/clerk-webhooks

Clerk webhooks for real-time events and data syncing. Verify with verifyWebhook from the framework-specific package. Handle user, session, organization, billing, and payment events. Build event-driven features like database sync, notifications, and integrations.

관련 스킬