From 1af6fa81f0fe07e58bc42002be3e2cc4f20283e6 Mon Sep 17 00:00:00 2001 From: Florian Gabach Date: Wed, 29 Jan 2020 15:51:46 +0100 Subject: [PATCH] SwiftUI readme exemple --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index e2eb0d8..3f5c55f 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,30 @@ openSourceVC.presentOpenSourceController(from: self) openSourceVC.pushOpenSourceController(from: self) ``` +With SwiftUI : + +```swift +struct OpenSourceView: UIViewControllerRepresentable { + @available(iOS 13, *) + public func updateUIViewController(_ uiViewController: OpenSourceViewController, context: UIViewControllerRepresentableContext) { + // + } + + @available(iOS 13, *) + public func makeUIViewController(context: UIViewControllerRepresentableContext) -> OpenSourceViewController { + let openSourceVC = OpenSourceViewController(licences: + [LicenceFile(title: "FacebookImagePicker", + url: "https://raw.githubusercontent.com/terflogag/FacebookImagePicker/master/LICENSE"), + LicenceFile(title: "JSQMessagesViewController", + url: "https://raw.githubusercontent.com/jessesquires/JSQMessagesViewController/develop/LICENSE")], + showCloseButton: true, + configuration: OpenSourceControllerConfig(), + licenceLoader: LicenceLoader()) + return openSourceVC + } +} +``` + ## Customisation You can apply some customisation. To do it you can use the OpenSourceControllerConfig structure like this :