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] Replace the grid/list switching icon #535

Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "ic_grid.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "ic_list.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions app-ios/Sources/TimetableFeature/TimetableListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public struct TimetableView: View {
}

@State var timetableMode = TimetableMode.list
@State var switchModeIcon: String = "square.grid.2x2"
@State var switchModeIcon: ImageResource = .icGrid
@State var selectedTab: DayTab = DayTab.day1

public var body: some View {
Expand Down Expand Up @@ -66,14 +66,15 @@ public struct TimetableView: View {
switch timetableMode {
case .list:
timetableMode = .grid
switchModeIcon = "list.bullet.indent"
switchModeIcon = .icList
case .grid:
timetableMode = .list
switchModeIcon = "square.grid.2x2"
switchModeIcon = .icGrid
}
} label: {
Image(systemName:switchModeIcon).foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
.frame(width: 40, height: 40)
Image(switchModeIcon)
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
.frame(width: 40, height: 40)
Comment on lines +75 to +77
Copy link
Contributor

Choose a reason for hiding this comment

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

The problem has not occurred because the original image color is onSurface, but I would expect that the color would not be changed unless the template is originally specified in the renderingMode modifier.

Suggested change
Image(switchModeIcon)
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
.frame(width: 40, height: 40)
Image(switchModeIcon)
.renderingMode(.template)
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
.frame(width: 40, height: 40)

I think it would be safer to add this one.
Alternatively, you can also set template-rendering-intent to imageset.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shin-usu
Thanks your review!
I think these icons should always be template mode, so I set rendering mode on imageset.
40b52d5
Please review again 🙏

}
}
}
Expand Down
Loading