Compare commits

...
10 Commits
Author SHA1 Message Date
Florian Gabach aa41530d47 4.1.1 release 2020-01-29 15:59:50 +01:00
Florian Gabach 1ac46a4859 Changelog 2020-01-29 15:59:22 +01:00
Florian Gabach 2c02475a49 Bump swift version & fix build 2020-01-29 15:59:01 +01:00
Florian Gabach 752558b420 4.1.0 release 2020-01-29 15:52:39 +01:00
Florian Gabach 1af6fa81f0 SwiftUI readme exemple 2020-01-29 15:51:46 +01:00
Florian Gabach 37c07f099a Prepare v4.1.0 2020-01-29 15:49:51 +01:00
Florian Gabach 612bb4ca11 Merge pull request #5 from SambaTV/master
SwiftUI support
2020-01-29 15:46:20 +01:00
Doron Katz e6fcda22fc Added SwiftUI support 2020-01-28 10:39:04 -08:00
Doron Katz f9282dcef2 Made init for struct public accessible 2020-01-28 10:21:38 -08:00
Doron Katz 8e47206f83 Made classes open instead of public, to access via SwiftUI 2020-01-28 10:21:17 -08:00
17 changed files with 76 additions and 25 deletions
+13
View File
@@ -1,6 +1,19 @@
Changelog
==========
### 4.1.1
- Fix build
### 4.1.0
- Add SwiftUI support (thanks to doronkatz)
### 4.0.2
- Fix pod release
- Add Github workflow
### 4.0.1
- Fix SPM
+1
View File
@@ -6,4 +6,5 @@ Contributors to the codebase :
| Name | Github handle | Mail |
| ------------- |------------- | ----- |
| David Lari | DavidLari | / |
| Doron Katz | | David Lari | DavidLari | / |
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'OpenSourceController'
s.version = '4.0.2'
s.version = '4.1.1'
s.summary = 'Display all the librarys licence used in your application. Enjoy !'
s.description = 'Display a screen with all licence used in your apply can be painful to maintain. OpenSourceController was built to respond to this problem. OpenSourceController is a simple parser to display the licences which are used in your application.'
s.homepage = 'https://github.com/floriangbh/OpenSourceController'
@@ -241,7 +241,7 @@
52D6D9851BEFF229002C0205 = {
CreatedOnToolsVersion = 7.1;
DevelopmentTeam = XEHEC9B46E;
LastSwiftMigration = "";
LastSwiftMigration = 1130;
};
};
};
@@ -499,7 +499,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.OpenSourceController.OpenSourceController-iOS-Tests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -514,7 +514,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.OpenSourceController.OpenSourceController-iOS-Tests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
+24
View File
@@ -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<OpenSourceView>) {
//
}
@available(iOS 13, *)
public func makeUIViewController(context: UIViewControllerRepresentableContext<OpenSourceView>) -> 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 :
@@ -6,9 +6,13 @@
// Copyright © 2018 OpenSourceController. All rights reserved.
//
#if !os(macOS)
import UIKit
#else
import AppKit
#endif
final class LicenceListViewController: UITableViewController {
open class LicenceListViewController: UITableViewController {
// MARK: - Var
@@ -24,11 +28,11 @@ final class LicenceListViewController: UITableViewController {
super.init(style: .plain)
}
required init?(coder aDecoder: NSCoder) {
required public init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
override open func viewDidLoad() {
super.viewDidLoad()
self.prepareTableView()
@@ -50,22 +54,22 @@ extension LicenceListViewController {
// MARK: - Table View Data Source
override func numberOfSections(in tableView: UITableView) -> Int {
override open func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
override open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.downloadedLicence.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
override open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell: OpenSourceTableViewCell = tableView.dequeueReusableCell(for: indexPath)
guard let licence = self.downloadedLicence.get(at: indexPath.row) else { return cell }
cell.configure(licence: licence, config: self.config)
return cell
}
override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
override open func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
}
@@ -8,7 +8,7 @@
import UIKit
final class LoadingViewController: UIViewController {
open class LoadingViewController: UIViewController {
// MARK: - Var
@@ -32,11 +32,11 @@ final class LoadingViewController: UIViewController {
super.init(nibName: nil, bundle: nil)
}
required init?(coder aDecoder: NSCoder) {
required public init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
override open func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = self.config.uiConfig.backgroundColor
@@ -6,7 +6,7 @@
import UIKit
final class OpenSourceTableViewCell: UITableViewCell, Reusable {
open class OpenSourceTableViewCell: UITableViewCell, Reusable {
// MARK: - Lifecycle
@@ -15,7 +15,7 @@ final class OpenSourceTableViewCell: UITableViewCell, Reusable {
self.prepareCellComponent()
}
required init?(coder aDecoder: NSCoder) {
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
@@ -6,7 +6,7 @@
import UIKit
final class OpenSourceViewController: UIViewController {
open class OpenSourceViewController: UIViewController {
// MARK: - Var
@@ -30,7 +30,7 @@ final class OpenSourceViewController: UIViewController {
// MARK: - Lifecyle
init(licences: [LicenceFile],
public init(licences: [LicenceFile],
showCloseButton: Bool,
configuration: OpenSourceControllerConfig,
licenceLoader: LicenceLoader) {
@@ -42,11 +42,11 @@ final class OpenSourceViewController: UIViewController {
super.init(nibName: nil, bundle: nil)
}
required init?(coder aDecoder: NSCoder) {
required public init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
override open func viewDidLoad() {
super.viewDidLoad()
self.title = self.config.title
+1 -1
View File
@@ -8,7 +8,7 @@
import Foundation
final class HTTPDataLoader {
open class HTTPDataLoader {
func loadData(fromUrl url: String, completion: @escaping (Data?) -> Void) {
if let url = URL(string: url) {
let task = URLSession.shared.dataTask(with: url) { (data, _, error) in
+3 -1
View File
@@ -6,7 +6,7 @@
import UIKit
final class LicenceLoader {
open class LicenceLoader {
/// Download every licence
///
@@ -32,4 +32,6 @@ final class LicenceLoader {
completion()
}
}
public init() {
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
import UIKit
public final class LicenceFile {
open class LicenceFile {
// MARK- Var
+4
View File
@@ -5,6 +5,9 @@
// Created by Florian Gabach on 05/02/2017.
import UIKit
#if canImport(SwiftUI)
import SwiftUI
#endif
open class OpenSourceController: NSObject {
@@ -43,3 +46,4 @@ open class OpenSourceController: NSObject {
navigationController.pushViewController(licenceController, animated: true)
}
}
+3
View File
@@ -35,5 +35,8 @@ public struct OpenSourceControllerConfig {
public var verbose: Bool = false
/// UI-specific configuration.
public init() {
}
public var uiConfig = UIConfig()
}
+2 -2
View File
@@ -9,12 +9,12 @@
import UIKit
extension UITableView {
final func register<T: UITableViewCell>(cellType: T.Type)
open func register<T: UITableViewCell>(cellType: T.Type)
where T: Reusable {
self.register(cellType.self, forCellReuseIdentifier: cellType.reuseIdentifier)
}
final func dequeueReusableCell<T: UITableViewCell>(for indexPath: IndexPath, cellType: T.Type = T.self) -> T
open func dequeueReusableCell<T: UITableViewCell>(for indexPath: IndexPath, cellType: T.Type = T.self) -> T
where T: Reusable {
guard let cell = self.dequeueReusableCell(withIdentifier: cellType.reuseIdentifier, for: indexPath) as? T else {
fatalError(