Skip to content

Commit

Permalink
Merge pull request #2 from shippingpark/main
Browse files Browse the repository at this point in the history
[Settings] #1 프로젝트 세팅: SwiftLint / Tuist / 프로젝트 구조
  • Loading branch information
shippingpark authored May 15, 2024
2 parents 5b5e840 + e19d4a6 commit 9704241
Show file tree
Hide file tree
Showing 34 changed files with 1,025 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Xcode ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

### Xcode Patch ###
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno

### Projects ###
*.xcodeproj
*.xcworkspace

### Tuist derived files ###
graph.dot
Derived/

### Tuist managed dependencies ###
Tuist/Dependencies
81 changes: 81 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
--- # 문서의 시작

# 기본 적용되는 룰에서 사용하지 않는 룰
disabled_rules:
- trailing_whitespace # 후행 공백 (선행 공백과 더불어 필요없다고 미적용이 불필요하다고 생각됨) - 선택 필요
- nesting # 중첩
- vertical_whitespace # 세로 공백
- redundant_optional_initialization # 옵셔널 타입을 nil로 초기화 중복
- unused_closure_parameter # 미사용 클로저 파라미터 _ 대체
- syntactic_sugar # 간결한 표현 (Array 대신 [Int] 등의 표현)
- cyclomatic_complexity # 순환 복잡성
- type_body_length # 타입 본문의 행 길이 제한
- file_length # 파일 줄 길이 제한
- unused_optional_binding # 사용되지 않는 옵셔널 바인딩 제한
- function_parameter_count # 파라미터 갯수 제한
- function_body_length # 함수 본문의 행 길이 제한
- large_tuple # 튜플 인자 수 제한
- unused_control_flow_label # 미사용 제어 플로우 제거
- trailing_comma # 배열 및 딕셔너리에서 후행 쉼표 조건 (적용 혹은 미적용)
- opening_brace # 중괄호 선언 조건 (중괄호 앞 단일 공백 및 선언과 같은 행)
- closure_parameter_position # 클로저 매개변수 위치 (중괄호와 같은 행)
- for_where # for where 절 선호 (for 문 내 if 사용 대체)
- inclusive_language # 포괄적 언어 사용 (인종, 성별, 사회경제적 지위를 나타내는 언어 사용금지)
- statement_position # 구문 위치 제한 (else, catch 등이 선언 바로 뒤 한칸 공백 후 위치함) - 선택 필요
- todo # TODO, FIXME 주석 제한
- private_over_fileprivate # fileprivate보다 private을 선호

# 옵트 인 룰
opt_in_rules:
- indentation_width # 인덴트 룰 적용
- closure_end_indentation # 클로저의 끝 괄호를 시작한 행과의 들여쓰기 맞춤
- empty_count # count보다 isEmpty 선호
- empty_string # == ""보다 isEmpty 선호
- sorted_imports # import 시 알파벳 순 정렬

# 인덴트 커스텀 정의
indentation_width:
indentation_width: 2
include_comments: false

# 타입 네이밍 커스텀 정의
type_name:
min_length:
warning: 1
max_length:
warning: 120
allowed_symbols:
- _

# 식별자 네이밍 커스텀 정의
identifier_name:
min_length:
warning: 0
error: 0
max_length:
warning: 120
error: 120
allowed_symbols:
- $
- _

# 콜론 커스텀 정의
colon:
apply_to_dictionaries: false # 딕셔너리에서 콜론이 키 옆에 있어야 하는 룰 미적용

# 행 길이 커스텀 정의
line_length:
ignores_urls: true # URL에 대해 행 길이 제한 미적용
ignores_comments: true # 코멘트에 대해 행 길이 제한 미적용
ignores_interpolated_strings: true # 보간된 문자열 행 길이 제한 미적용

# 룰 적용 제외할 파일
excluded:
- Tuist
- Project.swift
- Plugins
- Derived
- template
- .tuist-bin
- .git
... # 문서의 끝
15 changes: 15 additions & 0 deletions Plugins/Yanolja/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// swift-tools-version: 5.8

import PackageDescription

let package = Package(
name: "MyPlugin",
products: [
.executable(name: "tuist-my-cli", targets: ["tuist-my-cli"]),
],
targets: [
.executableTarget(
name: "tuist-my-cli"
),
]
)
3 changes: 3 additions & 0 deletions Plugins/Yanolja/Plugin.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ProjectDescription

let plugin = Plugin(name: "MyPlugin")
9 changes: 9 additions & 0 deletions Plugins/Yanolja/ProjectDescriptionHelpers/LocalHelper.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Foundation

public struct LocalHelper {
let name: String

public init(name: String) {
self.name = name
}
}
1 change: 1 addition & 0 deletions Plugins/Yanolja/Sources/tuist-my-cli/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello, from your Tuist Task")
31 changes: 31 additions & 0 deletions Project.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import ProjectDescription
import ProjectDescriptionHelpers
import MyPlugin

/*
+-------------+
| |
| App | Contains Yanolja App target and Yanolja unit-test target
| |
+------+-------------+-------+
| depends on |
| |
+----v-----+ +-----v-----+
| | | |
| Kit | | UI | Two independent frameworks to share code and start modularising your app
| | | |
+----------+ +-----------+

*/

// MARK: - Project

// Local plugin loaded
let localHelper = LocalHelper(name: "MyPlugin")

// Creates our project using a helper function defined in ProjectDescriptionHelpers
let project = Project.app(
name: "Yanolja",
destinations: .iOS,
additionalTargets: []
)
7 changes: 7 additions & 0 deletions Tuist/Config.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import ProjectDescription

let config = Config(
plugins: [
.local(path: .relativeToManifest("../../Plugins/Yanolja")),
]
)
93 changes: 93 additions & 0 deletions Tuist/ProjectDescriptionHelpers/Project+Templates.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import ProjectDescription
import Foundation

/// Project helpers are functions that simplify the way you define your project.
/// Share code to create targets, settings, dependencies,
/// Create your own conventions, e.g: a func that makes sure all shared targets are "static frameworks"
/// See https://docs.tuist.io/guides/helpers/

let teamName: String = "Yanolja"
let yanoljaOrganizationName: String = "com.mc2.yanolja"
let commonScripts: [TargetScript] = [
.pre(
script: """
ROOT_DIR=\(ProcessInfo.processInfo.environment["TUIST_ROOT_DIR"] ?? "")
${ROOT_DIR}/swiftlint --config ${ROOT_DIR}/.swiftlint.yml
""",
name: "SwiftLint",
basedOnDependencyAnalysis: false
)
]

extension Project {
/// Helper function to create the Project for this ExampleApp
public static func app(name: String, destinations: Destinations, additionalTargets: [String]) -> Project {
var targets = makeAppTargets(name: name,
destinations: destinations,
dependencies: additionalTargets.map { TargetDependency.target(name: $0) })
targets += additionalTargets.flatMap({ makeFrameworkTargets(name: $0, destinations: destinations) })
return Project(name: name,
organizationName: yanoljaOrganizationName,
targets: targets)
}

// MARK: - Private

/// Helper function to create a framework target and an associated unit test target
private static func makeFrameworkTargets(name: String, destinations: Destinations) -> [Target] {
let sources = Target(
name: name,
destinations: destinations,
product: .framework,
bundleId: "\(yanoljaOrganizationName).\(name)",
infoPlist: .default,
sources: ["\(name)/Sources/**"],
resources: [],
dependencies: []
)
let tests = Target(name: "\(name)Tests",
destinations: destinations,
product: .unitTests,
bundleId: "\(yanoljaOrganizationName).\(name)Tests",
infoPlist: .default,
sources: ["\(name)/Tests/**"],
resources: [],
dependencies: [.target(name: name)])
return [sources, tests]
}

/// Helper function to create the application target and the unit test target.
private static func makeAppTargets(name: String, destinations: Destinations, dependencies: [TargetDependency]) -> [Target] {
let infoPlist: [String: Plist.Value] = [
"CFBundleShortVersionString": "1.0",
"CFBundleVersion": "1",
"UILaunchStoryboardName": "LaunchScreen"
]

let mainTarget = Target(
name: name,
destinations: destinations,
product: .app,
bundleId: "\(yanoljaOrganizationName).\(name)",
infoPlist: .extendingDefault(with: infoPlist),
sources: ["\(name)/Sources/**"],
resources: ["\(name)/Resources/**"],
scripts: commonScripts,
dependencies: dependencies
)

let testTarget = Target(
name: "\(name)Tests",
destinations: destinations,
product: .unitTests,
bundleId: "\(yanoljaOrganizationName).\(name)Tests",
infoPlist: .default,
sources: ["\(name)/Tests/**"],
dependencies: [
.target(name: "\(name)")
])
return [mainTarget, testTarget]
}
}
13 changes: 13 additions & 0 deletions Yanolja/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions Yanolja/Resources/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading

0 comments on commit 9704241

Please sign in to comment.