-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from SchweizerischeBundesbahnen/feature/sbbIco…
…ns_enum Feature/sbb icons enum
- Loading branch information
Showing
7,608 changed files
with
76,755 additions
and
7,333 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
.swiftpm/xcode/xcshareddata/xcschemes/SBBDesignSystemMobileSwiftUI.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1420" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "SBBDesignSystemMobileSwiftUI_SBBDesignSystemMobileSwiftUI" | ||
BuildableName = "SBBDesignSystemMobileSwiftUI_SBBDesignSystemMobileSwiftUI" | ||
BlueprintName = "SBBDesignSystemMobileSwiftUI_SBBDesignSystemMobileSwiftUI" | ||
ReferencedContainer = "container:"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "SBBDesignSystemMobileSwiftUI" | ||
BuildableName = "SBBDesignSystemMobileSwiftUI" | ||
BlueprintName = "SBBDesignSystemMobileSwiftUI" | ||
ReferencedContainer = "container:"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "SBBDesignSystemMobileSwiftUI_SBBDesignSystemMobileSwiftUI" | ||
BuildableName = "SBBDesignSystemMobileSwiftUI_SBBDesignSystemMobileSwiftUI" | ||
BlueprintName = "SBBDesignSystemMobileSwiftUI_SBBDesignSystemMobileSwiftUI" | ||
ReferencedContainer = "container:"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Importing SBB Icons into the Design Library | ||
|
||
## Introduction | ||
|
||
This library offers all icons you can find in the official https://digital.sbb.ch/de/brand_elemente site. | ||
|
||
There are three different types of icons: | ||
* SBB-Icons: https://digital.sbb.ch/de/brand_elemente/icons | ||
* SBB-Timetable-Icons: https://digital.sbb.ch/de/brand_elemente/fahrplan-icons | ||
* SBB-Pictograms: https://digital.sbb.ch/de/brand_elemente/piktogramme | ||
|
||
In general, SBB-Icons are present in three different sizes (small, medium, large), meanwhile SBB-Timetable-Icons and SBB-Pictograms have each only one size. Also, you are allowed to change the colour of some of the above icons, and some of them not. In general you can say, that only the SBB-Icons can change their color. There is a list indicating what icons can change it. | ||
|
||
## Importing SBB Icons | ||
|
||
### SBB-Icons and SBB-Timetable-Icons: | ||
* Download the repo at: https://github.com/sbb-design-systems/sbb-icons/ | ||
* change folder name `icons` to `SBB Icons` | ||
* Replace the content of the file `index.json` with the content of the source file `Resources/SBBIconsIndex.json`. Then remove the `index.json` | ||
* Remove old `SBB Icons` of the Assets.xcassets | ||
* Move the newly downloaded and renamed `SBB Icons` folder into the Assets.xcassets | ||
* Select every icon in the Assets and change from "Individual Scales" to "Single Scale" | ||
|
||
Note that the `Resources/SBBIconsIndex.json` indicate, whether the icon is able to change color or not. | ||
|
||
### SBB-Pictograms: | ||
* Download the repo at: https://github.com/sbb-design-systems/picto-library/ | ||
* change folder name `pictos` to `SBB Pictos` | ||
* Remove old `SBB Pictos` of the Assets.xcassets | ||
* Move the newly downloaded and renamed `SBB Pictos` folder into the Assets.xcassets | ||
* Select every icon in the Assets and change from "Individual Scales" to "Single Scale" | ||
|
||
Building the Lib should now invoke the `generate_enum_file.swift` script, which generates the `Resources/SBBIconName.swift` file containing an enum with all the icons of the Assets.xcassets. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// Copyright © 2023 SBB. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
struct SBBIconsHelper { | ||
|
||
static let shared = SBBIconsHelper() | ||
|
||
let iconsIndex: SBBIconIndex? | ||
|
||
private init() { | ||
|
||
if let fileUrl = SBBBundle.getBundle().url(forResource: "SBBIconsIndex", withExtension: "json"), let sbbData = try? Data(contentsOf: fileUrl) { | ||
iconsIndex = try? JSONDecoder().decode(SBBIconIndex.self, from: sbbData) | ||
} else { | ||
iconsIndex = nil | ||
} | ||
} | ||
|
||
func hasColor(iconName: String) -> Bool { | ||
if let sbbIconMetadata = iconsIndex?.icons.first(where: {$0.name == iconName}) { | ||
return sbbIconMetadata.color | ||
} | ||
return false | ||
} | ||
|
||
} | ||
|
||
struct SBBIconMetadata: Decodable { | ||
let name: String | ||
let color: Bool | ||
let scalable: Bool | ||
let tags: [String] | ||
} | ||
|
||
struct SBBIconIndex: Decodable { | ||
let version: String | ||
let icons: [SBBIconMetadata] | ||
} |
6 changes: 3 additions & 3 deletions
6
SBBDesignSystemMobileSwiftUI/Resources/Assets.xcassets/Images/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} | ||
} |
6 changes: 0 additions & 6 deletions
6
...SystemMobileSwiftUI/Resources/Assets.xcassets/Images/SBB Icons/FPL/Attribut/Contents.json
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
...iftUI/Resources/Assets.xcassets/Images/SBB Icons/FPL/Attribut/sa-1.imageset/Contents.json
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-3.84 KB
...ileSwiftUI/Resources/Assets.xcassets/Images/SBB Icons/FPL/Attribut/sa-1.imageset/sa-1.pdf
Binary file not shown.
15 changes: 0 additions & 15 deletions
15
...iftUI/Resources/Assets.xcassets/Images/SBB Icons/FPL/Attribut/sa-2.imageset/Contents.json
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-4.19 KB
...ileSwiftUI/Resources/Assets.xcassets/Images/SBB Icons/FPL/Attribut/sa-2.imageset/sa-2.pdf
Binary file not shown.
15 changes: 0 additions & 15 deletions
15
...ftUI/Resources/Assets.xcassets/Images/SBB Icons/FPL/Attribut/sa-aa.imageset/Contents.json
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-3.89 KB
...eSwiftUI/Resources/Assets.xcassets/Images/SBB Icons/FPL/Attribut/sa-aa.imageset/sa-aa.pdf
Binary file not shown.
Oops, something went wrong.