Skip to content

Commit

Permalink
🎉 "Tuist 앱 모듈 작성을 위한 유틸리티 메서드 작성"
Browse files Browse the repository at this point in the history
  • Loading branch information
radiantchoi committed Dec 10, 2023
1 parent 6ec4135 commit cd62579
Show file tree
Hide file tree
Showing 19 changed files with 458 additions and 0 deletions.
70 changes: 70 additions & 0 deletions BeatCounter/.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
15 changes: 15 additions & 0 deletions BeatCounter/Plugins/BeatCounter/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// swift-tools-version: 5.4

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 BeatCounter/Plugins/BeatCounter/Plugin.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ProjectDescription

let plugin = Plugin(name: "MyPlugin")
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
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
//
// Project+Template.swift
// MyPlugin
//
// Created by Gordon Choi on 12/10/23.
//

import ProjectDescription

public extension Project {
enum Environment {
public static let appName = "BeatCounter"
public static let organizationName = "" // and so on
public static let deploymentTarget = DeploymentTarget.iOS(targetVersion: "17.0", devices: [.iphone, .ipad])
public static let bundlePrefix = "com." // and so on
// public static let watchDeploymentTarget = DeploymentTarget.watchOS(targetVersion: "10.0")
}
}

public extension Project {
static func makeAppModule(
name: String = Environment.appName,
bundleId: String,
platform: Platform = .iOS,
product: Product,
organizationName: String = Environment.organizationName,
packages: [Package] = [],
deploymentTarget: DeploymentTarget = Environment.deploymentTarget,
settings: Settings,
dependencies: [TargetDependency] = [],
sources: SourceFilesList = .sources,
resources: ResourceFileElements? = nil,
infoPlist: InfoPlist = .default,
entitlements: Path? = nil,
schemes: [Scheme] = []
) -> Project {
let appTarget = Target(
name: name,
platform: platform,
product: product,
bundleId: bundleId,
deploymentTarget: deploymentTarget,
infoPlist: infoPlist,
sources: sources,
resources: resources,
entitlements: entitlements,
scripts: [],
dependencies: dependencies
)

let targets = [appTarget]

return Project(
name: name,
organizationName: organizationName,
packages: packages,
settings: settings,
targets: targets,
schemes: schemes
)
}
}

public extension SourceFilesList {
static let sources: SourceFilesList = "Sources/"
}


Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello, from your Tuist Task")
29 changes: 29 additions & 0 deletions BeatCounter/Project.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import ProjectDescription
import ProjectDescriptionHelpers
import MyPlugin

/*
+-------------+
| |
| App | Contains BeatCounter App target and BeatCounter 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: "BeatCounter",
platform: .iOS,
additionalTargets: ["BeatCounterKit", "BeatCounterUI"])
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
11 changes: 11 additions & 0 deletions BeatCounter/Targets/BeatCounter/Sources/BeatCounterApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import SwiftUI
import BeatCounterUI

@main
struct BeatCounterApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
8 changes: 8 additions & 0 deletions BeatCounter/Targets/BeatCounter/Tests/BeatCounterTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Foundation
import XCTest

final class BeatCounterTests: XCTestCase {
func test_twoPlusTwo_isFour() {
XCTAssertEqual(2+2, 4)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Foundation

public final class BeatCounterKit {
public static func hello() {
print("Hello, from your Kit framework")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Foundation
import XCTest

final class BeatCounterKitTests: XCTestCase {
func test_example() {
XCTAssertEqual("BeatCounterKit", "BeatCounterKit")
}
}
17 changes: 17 additions & 0 deletions BeatCounter/Targets/BeatCounterUI/Sources/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import SwiftUI

public struct ContentView: View {
public init() {}

public var body: some View {
Text("Hello, World!")
.padding()
}
}


struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Foundation
import XCTest

final class BeatCounterUITests: XCTestCase {
func test_example() {
XCTAssertEqual("BeatCounterUI", "BeatCounterUI")
}
}
Loading

0 comments on commit cd62579

Please sign in to comment.