Skip to content

Commit

Permalink
doc: improve main README with some details
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
  • Loading branch information
pylapp committed Aug 6, 2024
1 parent df1ec8a commit e4ba46e
Showing 1 changed file with 51 additions and 3 deletions.
54 changes: 51 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

- [Status](#status)
- [Content](#content)
- [Integrate OUDS](#integrate-ouds)
* [Use Swift Package Manager](#use-swift-package-manager)
* [Import the library you need](#import-the-library-you-need)
* [Use themeable view](#use-themeable-view)
* [Define a custom theme if needed](#define-a-custom-theme-if-needed)
- [Bugs and feature requests](#bugs-and-feature-requests)
- [Contributing](#contributing)
- [Copyright and license](#copyright-and-license)
Expand All @@ -29,13 +34,56 @@ This repository contains the OUDS iOS library that provides Orange iOS component

## Integrate OUDS

### Use Swift Package Manager

If you want to add the iOS library of `Orange Unified Design System`, you need to add our _Swift Package_ into your project.
To do that, add a new _package dependency_ to your _Xcode_ project by refering to it with `https://github.com/Orange-OpenSource/ouds-ios`.
You are free to choose wether or not you want a branch or a specific tag.
Then you will be able to import the library and the product you want jsut with a simple import in your Swift files like:
You are free to choose wether or not you want a branch or a specific tag, pick the solution you want.

### Import the library you need

You should use one of the following imports for your needs:

```swift
import OUDSModules // To use modules
import OUDSComponents // To use components
import OUDSThemesOrange // To use the default theme
import OUDSThemesShared // If you want to define your theme or use OUDSThemeableView
import OUDSTokensComponent // If you need to override components tokens
import OUDSTokenSemantic // If you need to override semantic tokens
import OUDSTokensRaw // If you need to override raw tokens
```

### Use themeable view

```swift
// Make imports
import OUDSThemesShared
import OUDSThemesOrange

// Add themeable view to your root view
OUDSThemeableView(theme: OrangeTheme()) {
YourRootView()
}
```

### Define a custom theme if needed

```swift
import OUDS
class YourCustomTheme: OrangeTheme { }

extension YourCustomTheme {

// Override components tokens if needed
override var ftiBorderStyle: BorderStyleSemanticToken { borderStyleDrag }
override var ftiBorderWidth: BorderWidthSemanticToken { borderWidthThickest }

// Override colors semantic tokens if needed
override var colorBackgroundDefaultPrimaryLight: ColorSemanticToken! { ColorRawTokens.colorFunctionalSun500 }
override var colorBackgroundDefaultPrimaryDark: ColorSemanticToken! { ColorRawTokens.colorFunctionalSun800 }

// Etc.
}
```

## Bugs and feature requests
Expand Down

0 comments on commit e4ba46e

Please sign in to comment.