-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: ✏️ build documentation with DocC and host on swiftpackageindex.…
…com (#613)
- Loading branch information
1 parent
731c274
commit d8a028c
Showing
6 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
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,5 @@ | ||
version: 1 | ||
builder: | ||
configs: | ||
- documentation_targets: [FioriThemeManager, FioriCharts] | ||
platform: ios |
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,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CDAppleDefaultAvailability</key> | ||
<dict> | ||
<key>FioriThemeManager</key> | ||
<array> | ||
<dict> | ||
<key>name</key> | ||
<string>iOS</string> | ||
<key>version</key> | ||
<string>15.0</string> | ||
</dict> | ||
</array> | ||
</dict> | ||
</dict> | ||
</plist> |
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,7 @@ | ||
# ``FioriCharts`` | ||
|
||
Enterprise-ready charts in SwiftUI | ||
|
||
## Overview | ||
|
||
Easily add new chart components (donut, bullet, stocks, etc.) while modernizing the existing supported charts with pinch-to-zoom, pan, and new design features. |
56 changes: 56 additions & 0 deletions
56
Sources/FioriThemeManager/FioriThemeManager.docc/CustomizeColorPalette.md
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,56 @@ | ||
# Customize the Color Palette | ||
|
||
Override the global constants used for the ``ColorStyle`` cases | ||
|
||
## Overview | ||
|
||
You can choose one of the two options. | ||
|
||
### Programmatically | ||
|
||
Use one of the following methods: | ||
|
||
- ``ThemeManager/setColor(_:for:variant:)`` | ||
- ``ThemeManager/setHexColor(_:for:variant:)`` | ||
|
||
Example: | ||
|
||
```swift | ||
ThemeManager.shared.setColor(.mint, for: .primaryLabel) | ||
``` | ||
|
||
### Style Sheet | ||
|
||
Add global color definitions to the top of your style sheet file, using the following pattern: a leading `@` symbol, then the variable key followed by `:` and the variable value and finally end the line with `;` . | ||
|
||
Example: | ||
|
||
```swift | ||
@tintColor: blue; /* equivalent to @tintColor_lightBackground */ | ||
@tintColor_darkBackground: "12171CFF"; | ||
@tintColorTapState_lightBackground: "F5F6F7FF"; /* equivalent to @tintColorTapState */ | ||
@tintColorTapState_darkBackground : purple; | ||
``` | ||
|
||
The strings used as the variable name should match the string values of the ``ColorStyle`` enums, and optionally append `_lightBackground` or `_darkBackground`, to specialize the `background` parameter passed to the static ``SwiftUI/Color/preferredColor(_:background:interface:display:)`` invocation. | ||
|
||
Global color definitions in the style sheet file modify their corresponding attributes. All other color definitions for which an override is not provided retain their original values. | ||
|
||
As per the Fiori guidelines, when the background is not explicitly specified it defaults to the light background. For example, the global constants, ``ColorStyle/tintColor`` and `tintColor_lightBackground` are equivalent. Similarly, ``ColorStyle/primary1`` and `primary1_lightBackground` are equivalent. | ||
|
||
When overriding global constants in the style sheet file, if two equivalent constants are overridden, then the order of precedence is as shown below, where `Color.red` will be used for all invocations of `Color.preferredColor(.tintColor)` or `Color.preferredColor(.tintColor, background: .lightBackground)` : | ||
|
||
```swift | ||
@tintColor_lightBackground: red; /* This takes precedence over tintColor */ | ||
@tintColor: blue; | ||
@tintColorDark: green; | ||
``` | ||
|
||
> `tintColor` and `tintColor_lightBackground` also have another equivalent constant : `tintColorDark`. This has the last precedence. The dark background variant of it is `tintColorLight`, that is, `tintColorLight` and `tintColor_darkBackground` are equivalent. | ||
> Similarly `tintColorTapStateDark` is equivalent to `tintColorTapState` and `tintColorTapState_lightBackground` whereas `tintColorTapStateLight` and `tintColorTapState_darkBackground` are equivalent. | ||
```swift | ||
try? StyleSheetSettings.loadStylesheetByString(content: "@tintColor: blue;") | ||
|
||
// or load a style sheet from a local file with StyleSheetSettings.loadStylesheetByURL(url:) | ||
``` |
24 changes: 24 additions & 0 deletions
24
Sources/FioriThemeManager/FioriThemeManager.docc/Info.plist
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,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CDAppleDefaultAvailability</key> | ||
<dict> | ||
<key>FioriThemeManager</key> | ||
<array> | ||
<dict> | ||
<key>name</key> | ||
<string>watchOS</string> | ||
<key>version</key> | ||
<string>7.0</string> | ||
</dict> | ||
<dict> | ||
<key>name</key> | ||
<string>iOS</string> | ||
<key>version</key> | ||
<string>15.0</string> | ||
</dict> | ||
</array> | ||
</dict> | ||
</dict> | ||
</plist> |
60 changes: 60 additions & 0 deletions
60
Sources/FioriThemeManager/FioriThemeManager.docc/LandingPage.md
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,60 @@ | ||
# ``FioriThemeManager`` | ||
|
||
Use Fiori Colors, Fonts and Icons in your SwiftUI views | ||
|
||
## Overview | ||
|
||
This module provides APIs and the technical implementation for the following aspects of the [Fiori for iOS Design Language](https://experience.sap.com/fiori-design-ios/): | ||
|
||
- [**Colors**](https://experience.sap.com/fiori-design-ios/article/colors/) | ||
- [**Typography**](https://experience.sap.com/fiori-design-ios/article/typography/) | ||
- [**Iconography**](``FioriIcon``) | ||
|
||
### Colors | ||
|
||
A **color palette** consists of a set of vibrant colors providing a flexible yet consistent color system and distinct look to all SAP products. All Fiori Colors are dynamic colors, which means they will adjust based on iOS Appearance settings (Light/Dark). | ||
|
||
SDK-provided SwiftUI already use the color palette. | ||
|
||
Use ``SwiftUI/Color/preferredColor(_:background:interface:display:)`` to leverage Fiori colors in your SwiftUI views. | ||
|
||
```swift | ||
// Example | ||
var body: some View { | ||
Circle() | ||
.fill(Color.preferredColor(.primary)) | ||
} | ||
``` | ||
|
||
You can override the color values defined in the color palette and therefore influence the branding of your and SDK-provided SwiftUI views. See <doc:CustomizeColorPalette> for more information. | ||
|
||
### Typography | ||
|
||
**SAP 72** is the primary font for SAP Fiori for iOS. | ||
|
||
> Important: Call ``SwiftUI/Font/registerFioriFonts()`` inside `application(_:didFinishLaunchingWithOptions:)` of your `AppDelegate` to register 72 as a custom font. Otherwise the font won't be loaded. | ||
SDK-provided SwiftUI already use the font. | ||
|
||
Use ``SwiftUI/Font/fiori(forTextStyle:weight:isItalic:isCondensed:)`` to leverage 72 font in your SwiftUI views. | ||
|
||
```swift | ||
// example | ||
var body: some View { | ||
Text("Hello, World") | ||
.font(.fiori(forTextStyle: .headline)) | ||
} | ||
``` | ||
|
||
If you want the fonts with fixed size, use ``SwiftUI/Font/fiori(fixedSize:weight:isItalic:isCondensed:)`` instead. | ||
|
||
### Iconography | ||
|
||
The SAP Fiori for iOS icon library (``FioriIcon``) identifies a standard subset of SF Symbols that are aligned with the SAP Fiori design language. This allows us to have a robust collection that offers the familiarity, accessibility, and cohesiveness SAP customers expect across different platforms while still being consistent with the iOS experience. | ||
|
||
```swift | ||
// example | ||
var body: some View { | ||
Image(fioriName: "fiori.e.care") | ||
} | ||
``` |