From 082b7cf3ff5cd75fe43a352debd83b53438afb96 Mon Sep 17 00:00:00 2001 From: Murat Yilmaz Date: Thu, 1 Jul 2021 10:59:11 +0200 Subject: [PATCH] Add README documentation for modules --- Modules/BarcodeScanner/README.md | 26 ++++++++++++++++++++++++++ Modules/CarouselView/README.md | 15 +++++++++++++++ Modules/GridView/README.md | 25 +++++++++++++++++++++++++ Modules/Keychain/README.md | 10 ++++++++++ Modules/PageView/README.md | 16 ++++++++++++++++ Modules/UserDefaults/README.md | 12 ++++++++++++ 6 files changed, 104 insertions(+) create mode 100644 Modules/BarcodeScanner/README.md create mode 100644 Modules/CarouselView/README.md create mode 100644 Modules/GridView/README.md create mode 100644 Modules/Keychain/README.md create mode 100644 Modules/PageView/README.md create mode 100644 Modules/UserDefaults/README.md diff --git a/Modules/BarcodeScanner/README.md b/Modules/BarcodeScanner/README.md new file mode 100644 index 0000000..53e5e9d --- /dev/null +++ b/Modules/BarcodeScanner/README.md @@ -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() +``` diff --git a/Modules/CarouselView/README.md b/Modules/CarouselView/README.md new file mode 100644 index 0000000..78a920f --- /dev/null +++ b/Modules/CarouselView/README.md @@ -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.instantiate() + +// Configure the model of the carousel view by mapping the images +contentView.model = .init(pages: imageSourceURLs.map { .url($0) }) +``` diff --git a/Modules/GridView/README.md b/Modules/GridView/README.md new file mode 100644 index 0000000..79acb9f --- /dev/null +++ b/Modules/GridView/README.md @@ -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> = .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)") + } + } +) +``` diff --git a/Modules/Keychain/README.md b/Modules/Keychain/README.md new file mode 100644 index 0000000..0f8b67a --- /dev/null +++ b/Modules/Keychain/README.md @@ -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#>") + var topSecretSecuredValue: Bool +} +``` diff --git a/Modules/PageView/README.md b/Modules/PageView/README.md new file mode 100644 index 0000000..4c87822 --- /dev/null +++ b/Modules/PageView/README.md @@ -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.instantiate() + +// Configure the model +contentView.model = .init(pages: imageSourceURLs.map { .url($0) }) +``` diff --git a/Modules/UserDefaults/README.md b/Modules/UserDefaults/README.md new file mode 100644 index 0000000..d93f762 --- /dev/null +++ b/Modules/UserDefaults/README.md @@ -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) + var myPersistentProperty: Bool +} +```