SOC 직업 분류 기준
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/miles990/claude-software-skills --skill swift명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
Enterprise-grade repository analysis with arc42/C4 architecture documentation, technical debt quantification, security assessment, and multi-stakeholder reporting
Claude Code Plugin 開發、發布、安裝、更新與 Marketplace 管理完整指南
Flame Engine core fundamentals - components, input, collision, camera, animation, scenes
| name | swift |
| description | Swift programming patterns for iOS and macOS |
| domain | programming-languages |
| version | 1.0.0 |
| tags | ["swift","ios","macos","swiftui","concurrency"] |
| triggers | {"keywords":{"primary":["swift","ios","macos","swiftui","xcode","apple"],"secondary":["uikit","combine","async await","protocol","codable","spm"]},"context_boost":["mobile","app","apple","watchos","tvos"],"context_penalty":["android","java","kotlin","web"],"priority":"high"} |
Swift programming patterns including protocols, generics, async/await, and SwiftUI.
import Foundation
// Struct (value type, preferred for most cases)
struct User: Identifiable, Codable {
let id: UUID
var email: String
var name: String
var createdAt: Date
// Memberwise initializer provided automatically
// Custom initializer
init(email: String, name: String) {
self.id = UUID()
self.email = email
self.name = name
self.createdAt = Date()
}
// Computed property
var displayName: String {
"\(name) <\(email)>"
}
// Mutating method (for structs)
mutating func updateEmail(_ newEmail: String) {
email = newEmail
}
}
// Class (reference type)
class UserManager {
static let shared = UserManager() // Singleton
private var users: [UUID: User] = [:]
private init() {}
func add(_ user: User) {
users[user.id] = user
}
func find(id: UUID) -> User? {
users[id]
}
}
// Actor (thread-safe reference type)
actor UserStore {
private var users: [UUID: User] = [:]
func add(_ user: User) {
users[user.id] = user
}
func find(id: UUID) -> User? {
users[id]
}
func count() -> Int {
users.count
}
}
// Enum with associated values
enum Result<Success, Failure: Error> {
case success(Success)
case failure(Failure)
var isSuccess: Bool {
if case .success = self { return true }
return false
}
func map<NewSuccess>(_ transform: (Success) -> NewSuccess) -> Result<NewSuccess, Failure> {
switch self {
case .success(let value):
return .success(transform(value))
case .failure(let error):
return .failure(error)
}
}
}
// Enum with raw values
enum Status: String, Codable, CaseIterable {
case pending = "pending"
case active = "active"
case inactive =
displayName: {
{
.pending:
.active:
.inactive:
}
}
}
( : <, >) {
result {
.success( user) user.email.contains():
()
.success( user):
()
.failure( error):
()
}
}
.success( user) result {
(user.name)
}
( : <, >) -> ? {
.success( user) result {
}
user
}
// Optional declaration
var name: String? = nil
var age: Int? = 25
// Optional binding
if let name = name {
print("Name: \(name)")
}
// Multiple bindings
if let name = name, let age = age, age > 18 {
print("\(name) is \(age) years old")
}
// Guard let (early exit)
func processUser(_ user: User?) -> String {
guard let user = user else {
return "No user"
}
return user.displayName
}
// Nil coalescing
let displayName = name ?? "Anonymous"
// Optional chaining
let uppercased = name?.uppercased()
// Map and flatMap
let nameLength = name.map { .count }
parsed: ? .flatMap { () }
apiKey: !
// Protocol definition
protocol Repository {
associatedtype Entity: Identifiable
func find(id: Entity.ID) async throws -> Entity?
func findAll() async throws -> [Entity]
func save(_ entity: Entity) async throws
func delete(id: Entity.ID) async throws
}
// Protocol with default implementation
extension Repository {
func findAll() async throws -> [Entity] {
// Default implementation
[]
}
}
// Protocol composition
protocol Named {
var name: String { get }
}
protocol Aged {
var age: Int { get }
}
typealias &
( : ) {
()
}
{
() ->
}
: {
(: ) -> ? {
}
( : ) {
}
(: ) {
}
}
// Generic function
func swap<T>(_ a: inout T, _ b: inout T) {
let temp = a
a = b
b = temp
}
// Generic type
struct Stack<Element> {
private var items: [Element] = []
mutating func push(_ item: Element) {
items.append(item)
}
mutating func pop() -> Element? {
items.popLast()
}
var top: Element? {
items.last
}
var isEmpty: Bool {
items.isEmpty
}
}
// Generic constraints
func findIndex<T: Equatable>(of value: T, in array: [T]) -> Int? {
for (index, item) in array.enumerated() {
if item == value {
index
}
}
}
<: , : >(
: ,
:
) -> . ., .: {
c1.count c2.count { }
i c1.count {
c1[i] c2[i] { }
}
}
() -> {
[, , ]
}
<: <>>( : ) {
item collection {
(item)
}
}
// Async function
func fetchUser(id: String) async throws -> User {
let url = URL(string: "https://api.example.com/users/\(id)")!
let (data, _) = try await URLSession.shared.data(from: url)
return try JSONDecoder().decode(User.self, from: data)
}
// Concurrent execution
func fetchAllUsers(ids: [String]) async throws -> [User] {
try await withThrowingTaskGroup(of: User.self) { group in
for id in ids {
group.addTask {
try await fetchUser(id: id)
}
}
var users: [User] = []
for try await user in group {
users.append(user)
}
return users
}
}
// Async sequences
struct : {
start:
end:
: {
current:
end:
() -> ? {
current end { }
{ current }
.sleep(nanoseconds: )
current
}
}
() -> {
(current: start, end: end)
}
}
() {
number (start: , end: ) {
(number)
}
}
( : []) -> [] {
withThrowingTaskGroup(of: .) { group
item items {
group.addTask {
process(item)
}
}
group.reduce(into: []) { .append() }
}
}
{
value
() {
value
}
() -> {
value
}
}
: {
users: [] []
() {
{
fetched fetchAllUsers(ids: [, , ])
users fetched
} {
(error)
}
}
}
import SwiftUI
// View composition
struct UserListView: View {
@StateObject private var viewModel = UserListViewModel()
var body: some View {
NavigationStack {
List(viewModel.users) { user in
NavigationLink(value: user) {
UserRow(user: user)
}
}
.navigationTitle("Users")
.navigationDestination(for: User.self) { user in
UserDetailView(user: user)
}
.refreshable {
await viewModel.refresh()
}
.task {
await viewModel.loadUsers()
}
}
}
}
struct UserRow: View {
let user: User
var body: some View {
HStack {
AsyncImage(url: user.avatarURL) { image in
image
.resizable()
.aspectRatio(contentMode: .fill)
} placeholder: {
ProgressView()
}
.frame(width: 44, height: 44)
.clipShape(Circle())
VStack(alignment: .leading) {
Text(user.name)
.font(.headline)
(user.email)
.font(.subheadline)
.foregroundColor(.secondary)
}
}
}
}
: {
users: [] []
isLoading
error: ?
userService:
(: .shared) {
.userService userService
}
() {
isLoading
{ isLoading }
{
users userService.fetchUsers()
} {
.error error
}
}
() {
loadUsers()
}
}
: {
(: ) -> {
content
.padding()
.background((.systemBackground))
.cornerRadius()
.shadow(radius: )
}
}
{
() -> {
modifier(())
}
}
: {
defaultValue .shared
}
{
userService: {
{ [.] }
{ [.] newValue }
}
}
// Define errors
enum NetworkError: Error, LocalizedError {
case invalidURL
case noData
case decodingFailed(Error)
case serverError(statusCode: Int)
var errorDescription: String? {
switch self {
case .invalidURL:
return "Invalid URL"
case .noData:
return "No data received"
case .decodingFailed(let error):
return "Decoding failed: \(error.localizedDescription)"
case .serverError(let code):
return "Server error: \(code)"
}
}
}
// Throwing functions
func fetchData(from urlString: String) async throws -> Data {
guard let url = URL(string: urlString) else {
throw NetworkError.invalidURL
}
let (data, response) = try .shared.data(from: url)
httpResponse response {
.noData
}
().contains(httpResponse.statusCode) {
.serverError(statusCode: httpResponse.statusCode)
}
data
}
(: ) -> <, > {
{
data fetchData(from: )
user ().decode(., from: data)
.success(user)
} error {
.failure(error)
} {
.failure(.decodingFailed(error))
}
}
{
user fetchData(from: )
(user)
} .invalidURL {
()
} {
()
}
user fetchUser(id: )
definiteUser loadFromCache()