Skip to content

Commit f9b6bd6

Browse files
committed
feat: Update spmgen version
1 parent 05ca617 commit f9b6bd6

File tree

11 files changed

+59
-12
lines changed

11 files changed

+59
-12
lines changed

Dependencies/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let package = Package(
1111
.package(path: "../Extensions"),
1212
.package(
1313
url: "https://github.com/capturecontext/swift-package-resources.git",
14-
.upToNextMajor(from: "1.0.0")
14+
.upToNextMajor(from: "2.0.0")
1515
),
1616
],
1717
producibleTargets: [

Previews/MainFeature/main.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import UIKit
22
import MainFeature
33

4-
UIApplication.shared.launch(
5-
initialViewController: MainViewController()
6-
)
4+
UIApplication.shared
5+
.launchPreview(of: MainViewController())

Previews/Shared/SceneDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import UIKit
33
extension UIApplication {
44
fileprivate static var initialViewController: UIViewController!
55

6-
public func launch(
7-
initialViewController: UIViewController,
6+
public func launchPreview(
7+
of initialViewController: UIViewController,
88
appDelegate: UIApplicationDelegate = AppDelegate()
99
) {
1010
UIApplication.initialViewController = initialViewController

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Sources { // Main modules
6262
<#SomeFeature#>Feature // Any other feature
6363
AppUI // App-specific UI components
6464
APIClient // Service module example
65-
Resources // Contains resources and generated boilerplate
65+
Resources // Contains shared resources and generated boilerplate, but you can declare target-specific resources too, see https://github.com/capturecontext/spmgen
6666
}
6767
```
6868

Scripts/generate_resources.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ if ! $( is_installed "${TOOL}" ); then "${SCRIPT_DIR_PATH}/install_spmgen.sh"; f
1515
"$TOOL" resources "${SCRIPT_DIR_PATH}/../Sources/Resources/Resources" \
1616
--output "${SCRIPT_DIR_PATH}/../Sources/Resources/Resources.generated.swift" \
1717
--indentor " " \
18-
--indentation-width 2
18+
--tab-size 2
1919

2020
print_success "Did generate resources"

Scripts/install_spmgen.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ source "${SCRIPT_DIR_PATH}/.core/constants.sh"
1010
# CONFIG
1111
TOOL_NAME="spmgen"
1212
TOOL_OWNER="capturecontext"
13+
TOOL_VERSION="2.0.0"
1314

1415
# CONSTANTS
1516
TOOL_INSTALL_PATH="${TOOLS_INSTALL_PATH}/${TOOL_NAME}-tmp"
@@ -35,6 +36,10 @@ print ⬇️ "Fetching ${TOOL_NAME}..."
3536
git clone "https://github.com/${TOOL_OWNER}/${TOOL_NAME}.git"
3637
cd "${TOOL_NAME}"
3738

39+
print 🔧 "Switching to specified version..."
40+
git fetch --all --tags
41+
git checkout tags/${TOOL_VERSION} -b local
42+
3843
print 🔨 "Building ${TOOL_NAME}..."
3944
build_swift_product "${TOOL_NAME}"
4045

Sources/MainFeature/MainViewController.swift

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,31 @@ public final class MainViewController: UITabBarController {
99
setViewControllers(
1010
[
1111
UIHostingController(
12-
rootView: Text("First")
12+
rootView: VStack {
13+
Image.resource(.usgsUnsplash)
14+
.resizable()
15+
.aspectRatio(1, contentMode: .fill)
16+
.frame(width: 200, height: 200)
17+
.clipShape(RoundedRectangle(cornerRadius: 20, style: .continuous))
18+
Text("First")
19+
.fontWeight(.semibold)
20+
.foregroundColor(Color.white)
21+
.padding(.vertical, 6)
22+
.padding(.horizontal, 32)
23+
.background(Color.black)
24+
.clipShape(Capsule())
25+
}
1326
.frame(maxWidth: .infinity, maxHeight: .infinity)
1427
.background(
1528
LinearGradient(
1629
colors: [
17-
.blue,
18-
.green
30+
.orange,
31+
.red
1932
],
2033
startPoint: .top,
2134
endPoint: .bottom
2235
)
36+
.overlay(Color.black.opacity(0.1))
2337
.edgesIgnoringSafeArea(.all)
2438
)
2539
).configured { $0
@@ -31,6 +45,8 @@ public final class MainViewController: UITabBarController {
3145
},
3246
UIHostingController(
3347
rootView: Text("Second")
48+
.fontWeight(.semibold)
49+
.foregroundColor(Color.black)
3450
.frame(maxWidth: .infinity, maxHeight: .infinity)
3551
.background(
3652
LinearGradient(
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "usgs-hoS3dzgpHzw-unsplash.jpg",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"author" : "xcode",
19+
"version" : 1
20+
}
21+
}
479 KB
Loading

0 commit comments

Comments
 (0)