Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] ♻️ Enabled to use ttf files placed in commonMain on iOS. #1047

Merged
merged 16 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app-ios/App/DroidKaigi2023/DroidKaigi2023/App.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import Navigation
import SwiftUI
import Assets
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sort import orders 🙏🏼
I think SwiftLint warns this line when build iOS App.


@main
struct MainApp: App {
init() { FontAssets.registerAllCustomFonts() }

var body: some Scene {
WindowGroup {
RootView()
Expand Down
8 changes: 5 additions & 3 deletions app-ios/Modules/Sources/About/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public struct AboutView<ContributorView: View, StaffView: View, SponsorView: Vie
Assets.Images.aboutKeyVisual.swiftUIImage
Spacer().frame(height: 16)
Text("DroidKaigiはAndroid技術情報の共有とコミュニケーションを目的に開催されるエンジニアが主役のAndroidカンファレンスです。")
.font(Font.system(size: 16))
.font(Font.custom(FontAssets.Montserrat.medium, size: 16))
Spacer().frame(height: 12)
VStack(alignment: .leading, spacing: 12) {
InformationRow(
Expand Down Expand Up @@ -122,10 +122,12 @@ public struct AboutView<ContributorView: View, StaffView: View, SponsorView: Vie
.padding(.vertical, 24)

Text("アプリバージョン")
.font(Font.system(size: 14, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.fontWeight(.medium)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Q]
FontAssets.Montserrat.medium seems a medium-sized font, so is this modifier redundant? 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkhs0604
I was using the original description as is, so I certainly don't need this modifier.
I have removed it!🫡

Spacer().frame(height: 8)
Text(Bundle.main.formattedVersion)
.font(Font.system(size: 14, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.fontWeight(.medium)
}
.padding(16)
}
Expand Down
4 changes: 3 additions & 1 deletion app-ios/Modules/Sources/About/ListTile.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import SwiftUI
import Theme
import Assets

struct ListTile: View {
let icon: Image
Expand All @@ -11,7 +12,8 @@ struct ListTile: View {
.renderingMode(.template)
.foregroundStyle(AssetColors.Surface.onSurfaceVariant.swiftUIColor)
Text(title)
.font(Font.system(size: 14, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.fontWeight(.medium)
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
}
.padding(.horizontal, 12)
Expand Down
4 changes: 3 additions & 1 deletion app-ios/Modules/Sources/About/SectionTitle.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import SwiftUI
import Assets

struct SectionTitle: View {
let title: String

var body: some View {
Text(title)
.font(Font.system(size: 16, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 16))
.fontWeight(.medium)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.top, 16)
}
Expand Down
8 changes: 8 additions & 0 deletions app-ios/Modules/Sources/Assets/swiftgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@ json:
enumName: LottieAssets
publicAccess: true

fonts:
inputs: ../../../../../core/designsystem/src/commonMain/resources/font
outputs:
templateName: swift5
output: Fonts.swift
params:
enumName: FontAssets
publicAccess: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you introduce font with Theme module? 👀
I think font is related to theme.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ry-itto
Sorry if I have made a recognition error. 🙇
I am aware that this is the content of task #889 , is that correct?
I would like to define typography as a theme in task #889 after introducing it to the iOS project.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ry-itto
Please let me confirm. 🙇
Does this mean you want it defined in Theme/swiftgen.yml instead of Assets/swiftgen.yml?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean you want it defined in Theme/swiftgen.yml instead of Assets/swiftgen.yml?

Yes 🙏🏼

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ry-itto
Thank you very much for your patience. 🙇
Fixed to have Font resource in Theme.

10 changes: 7 additions & 3 deletions app-ios/Modules/Sources/Component/InformationRow.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import SwiftUI
import Theme
import Assets

public struct InformationRow: View {
private let icon: Image
Expand Down Expand Up @@ -34,16 +35,19 @@ public struct InformationRow: View {
icon
HStack(spacing: 12) {
Text(title)
.font(Font.system(size: 14, weight: .semibold))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Q]
We can embed Montserrat-SemiBold.ttf too, so how about using it instead?

.fontWeight(.semibold)
HStack {
Text(content)
.font(Font.system(size: 14, weight: .semibold))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.fontWeight(.semibold)
if let action = action {
Button {
action.action()
} label: {
Text(action.label)
.font(Font.system(size: 14, weight: .semibold))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.fontWeight(.semibold)
.underline()
.foregroundStyle(
AssetColors.Primary.primary.swiftUIColor
Expand Down
6 changes: 4 additions & 2 deletions app-ios/Modules/Sources/Component/PersonLabel.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import SwiftUI
import Theme
import Assets

public struct PersonLabel: View {
let name: String
Expand Down Expand Up @@ -32,12 +33,13 @@ public struct PersonLabel: View {
VStack(alignment: .leading) {
Text(name)
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
.font(Font.system(size: 16, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 16))
.fontWeight(.medium)
.lineLimit(2)
if let notes = notes {
Text(notes)
.foregroundStyle(AssetColors.Surface.onSurfaceVariant.swiftUIColor)
.font(Font.system(size: 12))
.font(Font.custom(FontAssets.Montserrat.medium, size: 12))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ struct FloorMapFooterSegmentedButton: View {
Assets.Icons.checkmark.swiftUIImage
}
Text("1F")
.font(.system(size: 14, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.fontWeight(.medium)
}
.foregroundStyle(AssetColors.Secondary.onSecondaryContainer.swiftUIColor)
}
Expand All @@ -49,7 +50,8 @@ struct FloorMapFooterSegmentedButton: View {
Assets.Icons.checkmark.swiftUIImage
}
Text("B1F")
.font(.system(size: 14, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.fontWeight(.medium)
}
.foregroundStyle(AssetColors.Secondary.onSecondaryContainer.swiftUIColor)
}
Expand Down
6 changes: 4 additions & 2 deletions app-ios/Modules/Sources/FloorMap/FloorMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public struct FloorMapView: View {
VStack(alignment: .leading, spacing: 24) {
VStack(alignment: .leading, spacing: 8) {
Text("1F")
.font(Font.system(size: 24, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 24))
.fontWeight(.medium)
Assets.Images.floor1F.swiftUIImage
.resizable()
.scaledToFit()
Expand All @@ -64,7 +65,8 @@ public struct FloorMapView: View {
VStack(alignment: .leading, spacing: 24) {
VStack(alignment: .leading, spacing: 8) {
Text("B1F")
.font(Font.system(size: 24, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 24))
.fontWeight(.medium)
Assets.Images.floorB1F.swiftUIImage
.resizable()
.scaledToFit()
Expand Down
9 changes: 6 additions & 3 deletions app-ios/Modules/Sources/FloorMap/SideEventRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@ struct SideEventRow: View {
.foregroundStyle(sideEvent.iconColor)

Text(sideEvent.title.currentLangTitle)
.font(.system(size: 14, weight: .bold))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.fontWeight(.bold)
}
// Description
Text(sideEvent.description_.currentLangTitle)
.font(.system(size: 14, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.fontWeight(.medium)
}
// Date
HStack(alignment: .center, spacing: 4) {
Assets.Icons.accessTime.swiftUIImage
.frame(width: 16, height: 16)

Text(sideEvent.timeText.currentLangTitle)
.font(.system(size: 12, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 12))
.fontWeight(.medium)
}
}
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
Expand Down
18 changes: 11 additions & 7 deletions app-ios/Modules/Sources/Session/SessionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public struct SessionView: View {
ScrollView {
VStack(alignment: .leading) {
Text(viewModel.timetableItem.title.currentLangTitle)
.font(Font.system(size: 24, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 24))
.fontWeight(.medium)
.foregroundStyle(AssetColors.Surface.onSurfaceVariant.swiftUIColor)
.padding(.horizontal, 16)
.padding(.vertical, 24)
Expand Down Expand Up @@ -85,7 +86,8 @@ public struct SessionView: View {
canBeExpanded = false
} label: {
Text("続きを読む")
.font(Font.system(size: 14, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.fontWeight(.medium)
.foregroundStyle(AssetColors.Primary.primary.swiftUIColor)
.frame(maxWidth: .infinity, minHeight: 40, maxHeight: 40, alignment: .center)
.overlay {
Expand All @@ -103,10 +105,11 @@ public struct SessionView: View {

VStack(alignment: .leading, spacing: 16) {
Text("対象者")
.font(Font.system(size: 14, weight: .semibold))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.fontWeight(.semibold)
.foregroundStyle(AssetColors.Surface.onSurfaceVariant.swiftUIColor)
Text(viewModel.timetableItem.targetAudience)
.font(Font.system(size: 16))
.font(Font.custom(FontAssets.Montserrat.medium, size: 16))
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
}
.padding(.vertical, 24)
Expand All @@ -116,7 +119,8 @@ public struct SessionView: View {

VStack(alignment: .leading, spacing: 16) {
Text("スピーカー")
.font(Font.system(size: 14, weight: .semibold))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.fontWeight(.semibold)
.foregroundStyle(AssetColors.Surface.onSurfaceVariant.swiftUIColor)

VStack(alignment: .leading, spacing: 8) {
Expand All @@ -136,10 +140,10 @@ public struct SessionView: View {
)
VStack(alignment: .leading, spacing: 0) {
Text(speaker.name)
.font(Font.system(size: 16))
.font(Font.custom(FontAssets.Montserrat.medium, size: 16))
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
Text(speaker.tagLine)
.font(Font.system(size: 12))
.font(Font.custom(FontAssets.Montserrat.medium, size: 12))
.foregroundStyle(AssetColors.Surface.onSurfaceVariant.swiftUIColor)
}
}
Expand Down
4 changes: 3 additions & 1 deletion app-ios/Modules/Sources/Sponsor/SponsorGridView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Model
import shared
import SwiftUI
import Theme
import Assets

struct SponsorGridView: View {

Expand All @@ -14,7 +15,8 @@ struct SponsorGridView: View {
var body: some View {
VStack(alignment: .leading, spacing: 16) {
Text(title)
.font(.system(size: 22, weight: .semibold, design: .default))
.font(Font.custom(FontAssets.Montserrat.medium, size: 22))
.fontWeight(.medium)
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
LazyVGrid(columns: Array(repeating: GridItem(spacing: 16), count: columns), spacing: 16) {
ForEach(sponsors) { sponsor in
Expand Down
2 changes: 1 addition & 1 deletion app-ios/Modules/Sources/Stamps/StampsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public struct StampsView: View {
ScrollView {
VStack(spacing: 24) {
Text("会場の各部屋に設置されたNFCタグにスマホをかざしてバッジを集めてみましょう。イベント最終日には、全てのバッジを集めた方にDroidKaigiのオリジナルグッズをプレゼントします。")
.font(Font.system(size: 16))
.font(Font.custom(FontAssets.Montserrat.medium, size: 16))
.foregroundStyle(AssetColors.Surface.onSurfaceVariant.swiftUIColor)
LazyVGrid(columns: [.init(), .init()]) {
Assets.Images.stampArcticFox.swiftUIImage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ private struct BookmarkEmptyView: View {
.clipShape(RoundedRectangle(cornerRadius: 24))
Spacer().frame(height: 24)
Text("登録されたセッションがありません")
.font(Font.system(size: 22))
.font(Font.custom(FontAssets.Montserrat.medium, size: 22))
.multilineTextAlignment(.center)
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
Spacer().frame(height: 8)
Text("気になるセッションをブックマークに追加して集めてみましょう!")
.font(Font.system(size: 14))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.multilineTextAlignment(.center)
.foregroundStyle(AssetColors.Surface.onSurfaceVariant.swiftUIColor)
}
Expand Down
3 changes: 2 additions & 1 deletion app-ios/Modules/Sources/Timetable/FilterLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ struct FilterLabel: View {
Assets.Icons.check.swiftUIImage
}
Text(title)
.font(Font.system(size: 14, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.fontWeight(.medium)
if isSelection {
Assets.Icons.arrowDropDown.swiftUIImage
}
Expand Down
4 changes: 3 additions & 1 deletion app-ios/Modules/Sources/Timetable/PersonLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Component
import shared
import SwiftUI
import Theme
import Assets

struct PersonLabel: View {
let speaker: TimetableSpeaker
Expand All @@ -23,7 +24,8 @@ struct PersonLabel: View {

Text(speaker.name)
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
.font(Font.system(size: 14, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.fontWeight(.medium)
.lineLimit(2)
}
.frame(maxWidth: .infinity, alignment: .leading)
Expand Down
3 changes: 2 additions & 1 deletion app-ios/Modules/Sources/Timetable/Search/SearchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ private struct SearchEmptyView: View {
.background(AssetColors.Secondary.secondaryContainer.swiftUIColor)
.clipShape(RoundedRectangle(cornerRadius: 24))
Text("「\(inputText)」と一致する検索結果がありません")
.font(Font.system(size: 16, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 16))
.fontWeight(.medium)
.multilineTextAlignment(.center)
.foregroundStyle(AssetColors.Surface.onSurfaceVariant.swiftUIColor)
}
Expand Down
4 changes: 3 additions & 1 deletion app-ios/Modules/Sources/Timetable/SessionTag.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import SwiftUI
import Assets

struct SessionTag: View {

Expand All @@ -21,7 +22,8 @@ struct SessionTag: View {

var body: some View {
Text(label)
.font(Font.system(size: 12, weight: .medium))
.font(Font.custom(FontAssets.Montserrat.medium, size: 12))
.fontWeight(.medium)
.padding(.horizontal, 8)
.padding(.vertical, 4)
.foregroundColor(labelColor)
Expand Down
7 changes: 5 additions & 2 deletions app-ios/Modules/Sources/Timetable/SessionTimeView.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Model
import SwiftUI
import Theme
import Assets

struct SessionTimeView: View {
var startsTimeString: String
Expand All @@ -10,14 +11,16 @@ struct SessionTimeView: View {
VStack(spacing: 4) {
Text(startsTimeString)
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
.font(Font(UIFont.systemFont(ofSize: 16, weight: .bold)))
.font(Font.custom(FontAssets.Montserrat.medium, size: 16))
.fontWeight(.bold)
.frame(height: 24)
Rectangle()
.foregroundColor(AssetColors.Outline.outlineVariant.swiftUIColor)
.frame(width: 2, height: 8)
Text(endsTimeString)
.foregroundStyle(AssetColors.Secondary.secondary.swiftUIColor)
.font(Font(UIFont.systemFont(ofSize: 16, weight: .bold)))
.font(Font.custom(FontAssets.Montserrat.medium, size: 16))
.fontWeight(.bold)
.frame(height: 24)
}
}
Expand Down
6 changes: 4 additions & 2 deletions app-ios/Modules/Sources/Timetable/TimetableDayHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ struct TimetableDayHeader: View {
} label: {
VStack(spacing: 0) {
Text(day.name)
.font(Font.system(size: 12, weight: .semibold))
.font(Font.custom(FontAssets.Montserrat.medium, size: 12))
.fontWeight(.semibold)
if !shouldCollapse {
Text("\(day.dayOfMonth)")
.font(Font.system(size: 24, weight: .semibold))
.font(Font.custom(FontAssets.Montserrat.medium, size: 24))
.fontWeight(.semibold)
.frame(height: 32)
}
}
Expand Down
Loading
Loading