Skip to content

Commit

Permalink
Merge pull request #65 from DroidKaigi/feature/color_set_ios
Browse files Browse the repository at this point in the history
Added color theme
  • Loading branch information
shin-usu authored Jun 23, 2024
2 parents 79a978a + 5f08b6e commit 1c35b9e
Show file tree
Hide file tree
Showing 20 changed files with 263 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,15 @@
"version" : "510.0.2"
}
},
{
"identity" : "swiftgenplugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SwiftGen/SwiftGenPlugin",
"state" : {
"revision" : "879b85a470cacd70c19e22eb7e11a3aed66f4068",
"version" : "6.6.2"
}
},
{
"identity" : "swiftui-navigation",
"kind" : "remoteSourceControl",
Expand Down
12 changes: 12 additions & 0 deletions app-ios/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ let package = Package(
.package(url: "https://github.com/pointfreeco/swift-composable-architecture.git", exact: "1.10.2"),
.package(url: "https://github.com/firebase/firebase-ios-sdk.git", exact: "10.26.0"),
.package(url: "https://github.com/cybozu/LicenseList.git", exact: "0.7.0"),
.package(url: "https://github.com/SwiftGen/SwiftGenPlugin", from: "6.6.2"),
],
targets: [
.target(
Expand Down Expand Up @@ -96,6 +97,7 @@ let package = Package(
name: "TimetableDetailFeature",
dependencies: [
.tca,
.theme,
]
),
.testTarget(
Expand Down Expand Up @@ -131,6 +133,15 @@ let package = Package(
]
),

.target(
name: "Theme",
resources: [
.process("Resources"),
.process("swiftgen.yml"),
],
plugins: [.plugin(name: "SwiftGenPlugin", package: "SwiftGenPlugin")]
),

// Please run ./gradlew app-ios-shared:assembleSharedXCFramework first
.binaryTarget(name: "KmpModule", path: "../app-ios-shared/build/XCFrameworks/debug/shared.xcframework"),
]
Expand All @@ -155,6 +166,7 @@ extension Target.Dependency {
static let aboutFeature: Target.Dependency = "AboutFeature"
static let favoriteFeature: Target.Dependency = "FavoriteFeature"
static let kmpModule: Target.Dependency = "KmpModule"
static let theme: Target.Dependency = "Theme"

static let firebaseAuth: Target.Dependency = .product(name: "FirebaseAuth", package: "firebase-ios-sdk")
static let firebaseRemoteConfig: Target.Dependency = .product(name: "FirebaseRemoteConfig", package: "firebase-ios-sdk")
Expand Down
3 changes: 3 additions & 0 deletions app-ios/Sources/Theme/File.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// empty file
// Due to SPM specifications, an error occurs if a Swift file of some kind does not exist, so an empty file is added.
// Currently there is no implementation that requires a Swift file, but this will be added later.
6 changes: 6 additions & 0 deletions app-ios/Sources/Theme/Resources/Colors.xcassets/Contents.json
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,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x61",
"green" : "0xE7",
"red" : "0x45"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x49",
"green" : "0x48",
"red" : "0x41"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x93",
"green" : "0x92",
"red" : "0x8B"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x15",
"green" : "0x39",
"red" : "0x00"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xC9",
"green" : "0xC8",
"red" : "0xC1"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xC4",
"green" : "0xC7",
"red" : "0xC5"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x20",
"green" : "0x20",
"red" : "0x1F"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x14",
"green" : "0x14",
"red" : "0x12"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
11 changes: 11 additions & 0 deletions app-ios/Sources/Theme/swiftgen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
input_dir: Resources/
output_dir: ${DERIVED_SOURCES_DIR}/

xcassets:
inputs: Colors.xcassets
outputs:
templateName: swift5
output: AssetColors.generated.swift
params:
enumName: AssetColors
publicAccess: true
5 changes: 3 additions & 2 deletions app-ios/Sources/TimetableDetailFeature/InformationRow.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import SwiftUI
import Theme

struct InformationRow: View {
private let icon: Image
Expand All @@ -21,12 +22,12 @@ struct InformationRow: View {
HStack(spacing: 12) {
Text(title)
.font(.callout)
.foregroundStyle(Color(.surfaceVariant))
.foregroundStyle(AssetColors.Surface.onSurfaceVariant.swiftUIColor)
.bold()
HStack {
Text(content)
.font(.callout)
.foregroundStyle(Color(.onSurface))
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import SwiftUI
import Theme

struct SessionDescriptionView: View {
@State private var isDescriptionExpanded: Bool = false
Expand All @@ -15,7 +16,7 @@ struct SessionDescriptionView: View {
.textSelection(.enabled)
.lineLimit(isDescriptionExpanded ? nil : 5)
.font(.callout)
.foregroundStyle(Color(.surfaceVariant))
.foregroundStyle(AssetColors.Surface.onSurfaceVariant.swiftUIColor)
.background {
ViewThatFits(in: .vertical) {
Text(content)
Expand All @@ -33,11 +34,11 @@ struct SessionDescriptionView: View {
canBeExpanded = false
} label: {
Text(String(localized: "TimeTableDetailReadMore", bundle: .module))
.foregroundStyle(Color(.primary))
.foregroundStyle(AssetColors.Custom.arcticFox.swiftUIColor)
.frame(width: 120, height: 40, alignment: .center)
.overlay {
Capsule()
.stroke(Color(.outline))
.stroke(AssetColors.Outline.outline.swiftUIColor)
}
}
}
Expand All @@ -50,5 +51,5 @@ struct SessionDescriptionView: View {
SessionDescriptionView(content: SampleData.sessionDescription)
.padding(.horizontal, 16)
}
.background(Color(.background))
.background(AssetColors.Surface.surface.swiftUIColor)
}
Loading

0 comments on commit 1c35b9e

Please sign in to comment.