Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
752558b420 | ||
|
|
1af6fa81f0 | ||
|
|
37c07f099a | ||
|
|
612bb4ca11 | ||
|
|
e6fcda22fc | ||
|
|
f9282dcef2 | ||
|
|
8e47206f83 |
@@ -1,6 +1,15 @@
|
|||||||
Changelog
|
Changelog
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
### 4.1.0
|
||||||
|
|
||||||
|
- Add SwiftUI support (thanks to doronkatz)
|
||||||
|
|
||||||
|
### 4.0.2
|
||||||
|
|
||||||
|
- Fix pod release
|
||||||
|
- Add Github workflow
|
||||||
|
|
||||||
### 4.0.1
|
### 4.0.1
|
||||||
|
|
||||||
- Fix SPM
|
- Fix SPM
|
||||||
|
|||||||
@@ -6,4 +6,5 @@ Contributors to the codebase :
|
|||||||
| Name | Github handle | Mail |
|
| Name | Github handle | Mail |
|
||||||
| ------------- |------------- | ----- |
|
| ------------- |------------- | ----- |
|
||||||
| David Lari | DavidLari | / |
|
| David Lari | DavidLari | / |
|
||||||
|
| Doron Katz | | David Lari | DavidLari | / |
|
||||||
|
|
||||||
|
|||||||
BIN
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = 'OpenSourceController'
|
s.name = 'OpenSourceController'
|
||||||
s.version = '4.0.2'
|
s.version = '4.1.0'
|
||||||
s.summary = 'Display all the librarys licence used in your application. Enjoy !'
|
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.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'
|
s.homepage = 'https://github.com/floriangbh/OpenSourceController'
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
76D7F24821BEB18A004B74CB /* Array+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76D7F24321BEB18A004B74CB /* Array+Extensions.swift */; };
|
76D7F24821BEB18A004B74CB /* Array+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76D7F24321BEB18A004B74CB /* Array+Extensions.swift */; };
|
||||||
76D7F24921BEB18A004B74CB /* UIView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76D7F24421BEB18A004B74CB /* UIView+Extensions.swift */; };
|
76D7F24921BEB18A004B74CB /* UIView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76D7F24421BEB18A004B74CB /* UIView+Extensions.swift */; };
|
||||||
76EAA84F1E93EDCD009A41DA /* LicenceFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76EAA84C1E93EDCD009A41DA /* LicenceFile.swift */; };
|
76EAA84F1E93EDCD009A41DA /* LicenceFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76EAA84C1E93EDCD009A41DA /* LicenceFile.swift */; };
|
||||||
|
C415E47723E0B3AE002F960D /* OpenSourceViewController+UISwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = C415E47623E0B3AE002F960D /* OpenSourceViewController+UISwift.swift */; };
|
||||||
|
C415E47823E0B3AE002F960D /* OpenSourceViewController+UISwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = C415E47623E0B3AE002F960D /* OpenSourceViewController+UISwift.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@@ -55,6 +57,7 @@
|
|||||||
76EAA84C1E93EDCD009A41DA /* LicenceFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LicenceFile.swift; path = Sources/Model/LicenceFile.swift; sourceTree = "<group>"; };
|
76EAA84C1E93EDCD009A41DA /* LicenceFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LicenceFile.swift; path = Sources/Model/LicenceFile.swift; sourceTree = "<group>"; };
|
||||||
AD2FAA261CD0B6D800659CF4 /* OpenSourceController.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = OpenSourceController.plist; sourceTree = "<group>"; };
|
AD2FAA261CD0B6D800659CF4 /* OpenSourceController.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = OpenSourceController.plist; sourceTree = "<group>"; };
|
||||||
AD2FAA281CD0B6E100659CF4 /* OpenSourceControllerTests.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = OpenSourceControllerTests.plist; sourceTree = "<group>"; };
|
AD2FAA281CD0B6E100659CF4 /* OpenSourceControllerTests.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = OpenSourceControllerTests.plist; sourceTree = "<group>"; };
|
||||||
|
C415E47623E0B3AE002F960D /* OpenSourceViewController+UISwift.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OpenSourceViewController+UISwift.swift"; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -137,6 +140,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
76229B7F2180ADA800A61697 /* OpenSourceController.swift */,
|
76229B7F2180ADA800A61697 /* OpenSourceController.swift */,
|
||||||
|
C415E47623E0B3AE002F960D /* OpenSourceViewController+UISwift.swift */,
|
||||||
76229B7E2180ADA800A61697 /* OpenSourceControllerConfig.swift */,
|
76229B7E2180ADA800A61697 /* OpenSourceControllerConfig.swift */,
|
||||||
76229B7B2180AD8E00A61697 /* Loader */,
|
76229B7B2180AD8E00A61697 /* Loader */,
|
||||||
76229B702180AD7700A61697 /* Model */,
|
76229B702180AD7700A61697 /* Model */,
|
||||||
@@ -241,7 +245,7 @@
|
|||||||
52D6D9851BEFF229002C0205 = {
|
52D6D9851BEFF229002C0205 = {
|
||||||
CreatedOnToolsVersion = 7.1;
|
CreatedOnToolsVersion = 7.1;
|
||||||
DevelopmentTeam = XEHEC9B46E;
|
DevelopmentTeam = XEHEC9B46E;
|
||||||
LastSwiftMigration = "";
|
LastSwiftMigration = 1130;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -295,6 +299,7 @@
|
|||||||
76D7F24721BEB18A004B74CB /* UIViewController+Extensions.swift in Sources */,
|
76D7F24721BEB18A004B74CB /* UIViewController+Extensions.swift in Sources */,
|
||||||
76EAA84F1E93EDCD009A41DA /* LicenceFile.swift in Sources */,
|
76EAA84F1E93EDCD009A41DA /* LicenceFile.swift in Sources */,
|
||||||
76D7F24521BEB18A004B74CB /* UITableView+Extensions.swift in Sources */,
|
76D7F24521BEB18A004B74CB /* UITableView+Extensions.swift in Sources */,
|
||||||
|
C415E47723E0B3AE002F960D /* OpenSourceViewController+UISwift.swift in Sources */,
|
||||||
769FD9D421871DEC00FB5A53 /* OpenSourceTableViewCell.swift in Sources */,
|
769FD9D421871DEC00FB5A53 /* OpenSourceTableViewCell.swift in Sources */,
|
||||||
76D7F24821BEB18A004B74CB /* Array+Extensions.swift in Sources */,
|
76D7F24821BEB18A004B74CB /* Array+Extensions.swift in Sources */,
|
||||||
76229B812180ADA800A61697 /* OpenSourceController.swift in Sources */,
|
76229B812180ADA800A61697 /* OpenSourceController.swift in Sources */,
|
||||||
@@ -308,6 +313,7 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
C415E47823E0B3AE002F960D /* OpenSourceViewController+UISwift.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -61,6 +61,30 @@ openSourceVC.presentOpenSourceController(from: self)
|
|||||||
openSourceVC.pushOpenSourceController(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
|
## Customisation
|
||||||
|
|
||||||
You can apply some customisation. To do it you can use the OpenSourceControllerConfig structure like this :
|
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.
|
// Copyright © 2018 OpenSourceController. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#if !os(macOS)
|
||||||
import UIKit
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
final class LicenceListViewController: UITableViewController {
|
open class LicenceListViewController: UITableViewController {
|
||||||
|
|
||||||
// MARK: - Var
|
// MARK: - Var
|
||||||
|
|
||||||
@@ -24,11 +28,11 @@ final class LicenceListViewController: UITableViewController {
|
|||||||
super.init(style: .plain)
|
super.init(style: .plain)
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder aDecoder: NSCoder) {
|
required public init?(coder aDecoder: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override open func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
self.prepareTableView()
|
self.prepareTableView()
|
||||||
@@ -50,22 +54,22 @@ extension LicenceListViewController {
|
|||||||
|
|
||||||
// MARK: - Table View Data Source
|
// MARK: - Table View Data Source
|
||||||
|
|
||||||
override func numberOfSections(in tableView: UITableView) -> Int {
|
override open func numberOfSections(in tableView: UITableView) -> Int {
|
||||||
return 1
|
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
|
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)
|
let cell: OpenSourceTableViewCell = tableView.dequeueReusableCell(for: indexPath)
|
||||||
guard let licence = self.downloadedLicence.get(at: indexPath.row) else { return cell }
|
guard let licence = self.downloadedLicence.get(at: indexPath.row) else { return cell }
|
||||||
cell.configure(licence: licence, config: self.config)
|
cell.configure(licence: licence, config: self.config)
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
|
override open func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
|
||||||
return UITableView.automaticDimension
|
return UITableView.automaticDimension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
final class LoadingViewController: UIViewController {
|
open class LoadingViewController: UIViewController {
|
||||||
|
|
||||||
// MARK: - Var
|
// MARK: - Var
|
||||||
|
|
||||||
@@ -32,11 +32,11 @@ final class LoadingViewController: UIViewController {
|
|||||||
super.init(nibName: nil, bundle: nil)
|
super.init(nibName: nil, bundle: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder aDecoder: NSCoder) {
|
required public init?(coder aDecoder: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override open func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
self.view.backgroundColor = self.config.uiConfig.backgroundColor
|
self.view.backgroundColor = self.config.uiConfig.backgroundColor
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
final class OpenSourceTableViewCell: UITableViewCell, Reusable {
|
open class OpenSourceTableViewCell: UITableViewCell, Reusable {
|
||||||
|
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ final class OpenSourceTableViewCell: UITableViewCell, Reusable {
|
|||||||
self.prepareCellComponent()
|
self.prepareCellComponent()
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder aDecoder: NSCoder) {
|
required public init?(coder aDecoder: NSCoder) {
|
||||||
super.init(coder: aDecoder)
|
super.init(coder: aDecoder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
final class OpenSourceViewController: UIViewController {
|
open class OpenSourceViewController: UIViewController {
|
||||||
|
|
||||||
// MARK: - Var
|
// MARK: - Var
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ final class OpenSourceViewController: UIViewController {
|
|||||||
|
|
||||||
// MARK: - Lifecyle
|
// MARK: - Lifecyle
|
||||||
|
|
||||||
init(licences: [LicenceFile],
|
public init(licences: [LicenceFile],
|
||||||
showCloseButton: Bool,
|
showCloseButton: Bool,
|
||||||
configuration: OpenSourceControllerConfig,
|
configuration: OpenSourceControllerConfig,
|
||||||
licenceLoader: LicenceLoader) {
|
licenceLoader: LicenceLoader) {
|
||||||
@@ -42,11 +42,11 @@ final class OpenSourceViewController: UIViewController {
|
|||||||
super.init(nibName: nil, bundle: nil)
|
super.init(nibName: nil, bundle: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder aDecoder: NSCoder) {
|
required public init?(coder aDecoder: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override open func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
self.title = self.config.title
|
self.title = self.config.title
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
final class HTTPDataLoader {
|
open class HTTPDataLoader {
|
||||||
func loadData(fromUrl url: String, completion: @escaping (Data?) -> Void) {
|
func loadData(fromUrl url: String, completion: @escaping (Data?) -> Void) {
|
||||||
if let url = URL(string: url) {
|
if let url = URL(string: url) {
|
||||||
let task = URLSession.shared.dataTask(with: url) { (data, _, error) in
|
let task = URLSession.shared.dataTask(with: url) { (data, _, error) in
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
final class LicenceLoader {
|
open class LicenceLoader {
|
||||||
|
|
||||||
/// Download every licence
|
/// Download every licence
|
||||||
///
|
///
|
||||||
@@ -32,4 +32,6 @@ final class LicenceLoader {
|
|||||||
completion()
|
completion()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public init() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public final class LicenceFile {
|
open class LicenceFile {
|
||||||
|
|
||||||
// MARK- Var
|
// MARK- Var
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
// Created by Florian Gabach on 05/02/2017.
|
// Created by Florian Gabach on 05/02/2017.
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
#if canImport(SwiftUI)
|
||||||
|
import SwiftUI
|
||||||
|
#endif
|
||||||
|
|
||||||
open class OpenSourceController: NSObject {
|
open class OpenSourceController: NSObject {
|
||||||
|
|
||||||
@@ -43,3 +46,4 @@ open class OpenSourceController: NSObject {
|
|||||||
navigationController.pushViewController(licenceController, animated: true)
|
navigationController.pushViewController(licenceController, animated: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,5 +35,8 @@ public struct OpenSourceControllerConfig {
|
|||||||
public var verbose: Bool = false
|
public var verbose: Bool = false
|
||||||
|
|
||||||
/// UI-specific configuration.
|
/// UI-specific configuration.
|
||||||
|
|
||||||
|
public init() {
|
||||||
|
}
|
||||||
public var uiConfig = UIConfig()
|
public var uiConfig = UIConfig()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
extension UITableView {
|
extension UITableView {
|
||||||
final func register<T: UITableViewCell>(cellType: T.Type)
|
open func register<T: UITableViewCell>(cellType: T.Type)
|
||||||
where T: Reusable {
|
where T: Reusable {
|
||||||
self.register(cellType.self, forCellReuseIdentifier: cellType.reuseIdentifier)
|
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 {
|
where T: Reusable {
|
||||||
guard let cell = self.dequeueReusableCell(withIdentifier: cellType.reuseIdentifier, for: indexPath) as? T else {
|
guard let cell = self.dequeueReusableCell(withIdentifier: cellType.reuseIdentifier, for: indexPath) as? T else {
|
||||||
fatalError(
|
fatalError(
|
||||||
|
|||||||
Reference in New Issue
Block a user