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

Add README documentation for modules #50

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
26 changes: 26 additions & 0 deletions Modules/BarcodeScanner/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# BarcodeScanner

The barcode scanner presents a video capturing preview and scans the content of it for barcodes.

Example:
```swift
// Instantiation of the barcode scanner view.
let barcodeScannerView = BarcodeScannerView.instantiate()

// Configuration of the expected barcode types and the callbacks.
barcodeScannerView.model = .init(
barcodeTypes: [.qr],
onScan: { barcodes in
print(barcodes)
},
onError: { error in
print(error)
}
)

// Starting the scan process.
scannerView.startScanning()

// Stopping the scan process.
scannerView.stopScanning()
```
15 changes: 15 additions & 0 deletions Modules/CarouselView/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# CarouselView

The carousel view adds carousel scroll behaviour to an embedded generic `ContentView`.

Example:
```swift
// The image urls to be presented as content
let imageSourceURLs: [URL] = [<#image sources#>]

// Instantiate carousel view with `ImageView` as content views
let contentView = CarouselView<ImageView>.instantiate()

// Configure the model of the carousel view by mapping the images
contentView.model = .init(pages: imageSourceURLs.map { .url($0) })
```
25 changes: 25 additions & 0 deletions Modules/GridView/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# GridView

The grid view presents a collection of generic `ItemView`s in a grid based layout.

Example:

```swift
// The image urls to be presented as content
let imageSourceURLs: [URL] = [<#image sources#>]

// Instantiation with an image view listening to touch events through the action view
let gridView: GridView<ActionView<ImageView>> = .instantiate()

// Model configuration
gridView.model = GridViewModel(
insets: .zero,
spacing: .zero,
numberOfColumns: 3,
items: imageSourceURLs.map { imageSourceURL in
return ActionViewModel(content: .url(imageSourceURL)) { [unowned self] in
print("Did tap image view with url: \(imageSourceURL)")
}
}
)
```
10 changes: 10 additions & 0 deletions Modules/Keychain/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Keychain

The keychain module provides an easy to use API agnostic to the device keychain and the iOS `Security` framework.

```swift
struct MyDataRepository {
@Secured(key: "<#keychain value identifier#>")
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could add an example for the full usage, together with passing the keychain instance

var topSecretSecuredValue: Bool
}
```
16 changes: 16 additions & 0 deletions Modules/PageView/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# PageView

The page view adds paged scroll behaviour to an embedded `ContentView`.

Example:

```swift
// The image urls to be presented as content
let imageSourceURLs: [URL] = [<#image sources#>]

// Instantiate a page view with image views as content
let contentView = PageView<ImageView>.instantiate()

// Configure the model
contentView.model = .init(pages: imageSourceURLs.map { .url($0) })
```
12 changes: 12 additions & 0 deletions Modules/UserDefaults/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# UserDefaults

The user defaults module provides a property wrapper to access data in the device user defaults storage.

Example:

```swift
struct MyDataRepository {
@UserDefault(key: "<#value identifier#>", defaultValue: true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you could adjust the example in the way that a user defaults instance can be passed.

var myPersistentProperty: Bool
}
```