diff --git a/Example/Controllers/ViewController.swift b/Example/Controllers/ViewController.swift index 2a17925c..7f179a7c 100644 --- a/Example/Controllers/ViewController.swift +++ b/Example/Controllers/ViewController.swift @@ -34,9 +34,11 @@ class ViewController: UITableViewController { switch segmentControl.selectedSegmentIndex { case 0: let controller = SPPermissions.list(selectedPermissions) + controller.dataSource = self controller.present(on: self) case 1: let controller = SPPermissions.dialog(selectedPermissions) + controller.dataSource = self controller.present(on: self) case 2: break @@ -46,6 +48,16 @@ class ViewController: UITableViewController { } } +/** + DataSource for each permission. REturn nil if you want use default data. + */ +extension ViewController: SPPermissionsDataSource { + + func data(for permission: SPPermission) -> SPPermissionData? { + return nil + } +} + extension ViewController { override func numberOfSections(in tableView: UITableView) -> Int { diff --git a/SPPermissions.podspec b/SPPermissions.podspec index fd7050df..66ad04bf 100644 --- a/SPPermissions.podspec +++ b/SPPermissions.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "SPPermissions" - s.version = "5.0.3" + s.version = "5.0.4" s.summary = "Ask permissions on Swift. Available List, Dialog & Native interface. Can check state permission." s.homepage = "https://github.com/IvanVorobei/SPPermissions" s.source = { :git => "https://github.com/IvanVorobei/SPPermissions.git", :tag => s.version } diff --git a/Source/SPPermissions/Models/SPPermissionData.swift b/Source/SPPermissions/Models/SPPermissionData.swift index 98a0e158..06c211a7 100644 --- a/Source/SPPermissions/Models/SPPermissionData.swift +++ b/Source/SPPermissions/Models/SPPermissionData.swift @@ -37,4 +37,12 @@ public struct SPPermissionData { var image: UIImage? var allowTitle: String var allowedTitle: String + + public init(name: String, description: String, image: UIImage?, allowTitle: String, allowedTitle: String) { + self.name = name + self.description = description + self.image = image + self.allowTitle = allowTitle + self.allowedTitle = allowedTitle + } }