Skip to content

Commit

Permalink
Uses compiled assets instead of named system images, adds image docum…
Browse files Browse the repository at this point in the history
…entation to README
  • Loading branch information
kokaubeam committed Aug 25, 2024
1 parent 2c60ab3 commit aa9344b
Show file tree
Hide file tree
Showing 8 changed files with 298 additions and 5 deletions.
6 changes: 6 additions & 0 deletions Etymo/Assets.xcassets/Symbols/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,12 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"symbols" : [
{
"filename" : "text.page.badge.magnifyingglass.svg",
"idiom" : "universal"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions Etymo/Assets.xcassets/Symbols/wifi.slash.symbolset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"symbols" : [
{
"filename" : "wifi.slash.svg",
"idiom" : "universal"
}
]
}
125 changes: 125 additions & 0 deletions Etymo/Assets.xcassets/Symbols/wifi.slash.symbolset/wifi.slash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Etymo/ContentUnavailableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct ContentUnavailableView: View {

#Preview {
ContentUnavailableView(
image: Image(systemName: "wifi.slash"),
image: Image(.wifiSlash),
title: "Not Connected",
description: "Unable to lookup words while offline.\nCheck your Internet connection."
)
Expand Down
7 changes: 3 additions & 4 deletions Etymo/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ struct ContentView: View {
.frame(width: geometry.size.width)
.frame(minHeight: geometry.size.height)
}

.navigationTitle("Etymo")
.searchable(text: $viewModel.searchText, prompt: "Word")
}
Expand All @@ -44,7 +43,7 @@ struct ContentView: View {

var emptySearchView: some View {
ContentUnavailableView(
image: Image(systemName: "text.page.badge.magnifyingglass"),
image: Image(.textPageBadgeMagnifyingglass),
title: "Enter a Word",
description: "Type a word into the search to see its definitions."
)
Expand All @@ -53,7 +52,7 @@ struct ContentView: View {

var noResultsView: some View {
ContentUnavailableView(
image: Image(systemName: "text.page.badge.magnifyingglass"),
image: Image(.textPageBadgeMagnifyingglass),
title: "No Results",
description: "Check the spelling or try a new search."
)
Expand All @@ -62,7 +61,7 @@ struct ContentView: View {

var notConnectedView: some View {
ContentUnavailableView(
image: Image(systemName: "wifi.slash"),
image: Image(.wifiSlash),
title: "Not Connected",
description: "Unable to lookup words while offline.\nCheck your Internet connection."
)
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ Explore words like never before with definitions, origins, usage, and more in on

Open `Etymo.xcodeproj` and build/run the project.

### Images

Convert all icons to [symbols](https://developer.apple.com/documentation/uikit/uiimage/creating_custom_symbol_images_for_your_app) and store them in `Assets.xcassets/Symbols`. Export symbols from [SF Symbols](https://developer.apple.com/sf-symbols/) or use [SF Symbol Creator](https://www.figma.com/community/plugin/1207724751253683840) to export custom icons from Figma.

Use compiled assets instead of string named images:

```
// Incorrect
Image("star")
// Correct
Image(.star)
```

### Device Support

Support is provided for the most current version and the previous version of iOS and iPadOS, as well as for earlier versions until their usage falls below 10%. For the latest statistics, see [iOS and iPadOS Usage](https://developer.apple.com/support/app-store/).
Expand Down

0 comments on commit aa9344b

Please sign in to comment.