Skip to content

Commit

Permalink
Merge branch 'feat/did_select_and_deselect_item_delegate'
Browse files Browse the repository at this point in the history
  • Loading branch information
pavankataria committed Feb 24, 2019
2 parents 7057ed0 + 90f3175 commit 010f691
Show file tree
Hide file tree
Showing 15 changed files with 655 additions and 586 deletions.
4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- SwiftDataTables (0.6.22)
- SwiftDataTables (0.6.31)

DEPENDENCIES:
- SwiftDataTables (from `../`)
Expand All @@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
SwiftDataTables: a0f1aad8fe0a3677e549d8c264699b97d2e4d304
SwiftDataTables: bb53425fb44df8ab69f798d9b80648ee8641c36e

PODFILE CHECKSUM: 117ac710a88fe801ecac2a925baa29b1107fef2e

Expand Down
4 changes: 2 additions & 2 deletions Example/Pods/Local Podspecs/SwiftDataTables.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

804 changes: 412 additions & 392 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 9 additions & 11 deletions Example/SwiftDataTables.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = "<group>"; };
757EF188D22DBACA6CE9D49C /* Pods-SwiftDataTables_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftDataTables_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftDataTables_Tests/Pods-SwiftDataTables_Tests.debug.xcconfig"; sourceTree = "<group>"; };
776C66EDD196D1AFE38BB82F /* Pods-SwiftDataTables_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftDataTables_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftDataTables_Example/Pods-SwiftDataTables_Example.release.xcconfig"; sourceTree = "<group>"; };
7C3CE24995B8413154598310 /* SwiftDataTables.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = SwiftDataTables.podspec; path = ../SwiftDataTables.podspec; sourceTree = "<group>"; };
7C3CE24995B8413154598310 /* SwiftDataTables.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = SwiftDataTables.podspec; path = ../SwiftDataTables.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
9F256AB137A0214B765522F8 /* Pods-SwiftDataTables_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftDataTables_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftDataTables_Example/Pods-SwiftDataTables_Example.debug.xcconfig"; sourceTree = "<group>"; };
E1E2C421370D3CFB2097E599 /* Pods-SwiftDataTables_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftDataTables_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftDataTables_Tests/Pods-SwiftDataTables_Tests.release.xcconfig"; sourceTree = "<group>"; };
E773E3A98AF8683E036CC9BC /* Pods_SwiftDataTables_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftDataTables_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -221,12 +221,12 @@
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = R85C7FUGTC;
LastSwiftMigration = 0900;
LastSwiftMigration = 1010;
};
607FACE41AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = R85C7FUGTC;
LastSwiftMigration = 0900;
LastSwiftMigration = 1010;
TestTargetID = 607FACCF1AFB9204008FA782;
};
};
Expand Down Expand Up @@ -421,6 +421,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand Down Expand Up @@ -468,6 +469,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -488,8 +490,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "SwiftDataTables/SwiftDataTables_Example-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -509,8 +510,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "SwiftDataTables/SwiftDataTables_Example-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -533,8 +533,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -552,8 +551,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
7 changes: 3 additions & 4 deletions Example/SwiftDataTables/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var navigationController: UINavigationController?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let window = UIWindow(frame: UIScreen.main.bounds)
let instance = MenuViewController()
let navigationController = UINavigationController(rootViewController: instance)
self.navigationController = navigationController
window.rootViewController = navigationController
self.navigationController = UINavigationController(rootViewController: instance)
window.rootViewController = self.navigationController
self.window = window
window.makeKeyAndVisible()
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ class DataTableWithDataSetViewController: UIViewController {
self.dataTable.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.dataTable.frame = self.view.frame
self.view.addSubview(self.dataTable);
self.dataTable.delegate = self
}
}
extension DataTableWithDataSetViewController: SwiftDataTableDelegate {
func didSelectItem(_ dataTable: SwiftDataTable, indexPath: IndexPath) {
print("did select item at indexPath: \(indexPath)")
}
}

extension DataTableWithDataSetViewController {
func columnHeaders() -> [String] {
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class DataTableWithDataSourceViewController: UIViewController {
self.view.backgroundColor = UIColor.white

self.dataTable = SwiftDataTable(dataSource: self)
self.dataTable.delegate = self
self.dataTable.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.dataTable.frame = self.view.frame
self.view.addSubview(self.dataTable);
Expand Down Expand Up @@ -76,3 +77,9 @@ extension DataTableWithDataSourceViewController: SwiftDataTableDataSource {
return self.dataSource[index]
}
}

extension DataTableWithDataSourceViewController: SwiftDataTableDelegate {
func didSelectItem(_ dataTable: SwiftDataTable, indexPath: IndexPath) {
print("did select item at indexPath: \(indexPath)")
}
}
9 changes: 8 additions & 1 deletion Example/SwiftDataTables/MenuTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ class GenericDataTableViewController: UIViewController {
self.dataTable.backgroundColor = UIColor(red: 235/255, green: 235/255, blue: 235/255, alpha: 1)
self.dataTable.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.dataTable.frame = self.view.frame
self.view.addSubview(self.dataTable);
self.view.addSubview(self.dataTable)
self.dataTable.delegate = self
}
func columnHeaders() -> [String] {
return [
Expand All @@ -106,6 +107,12 @@ class GenericDataTableViewController: UIViewController {
}
}
}

extension GenericDataTableViewController: SwiftDataTableDelegate {
func didSelectItem(_ dataTable: SwiftDataTable, indexPath: IndexPath) {
print("did select item at indexPath: \(indexPath)")
}
}
//MARK: - Data source and delegate methods
extension MenuViewController {
override func numberOfSections(in tableView: UITableView) -> Int {
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ An optional delegate for further customisation. Default values will be used retr
```Swift

@objc public protocol SwiftDataTableDelegate: class {
/// This is fired when a row is selected.
///
/// - Parameters:
/// - dataTable: SwiftDataTable
/// - indexPath: the index path of the row selected
@objc optional func didSelectItem(_ dataTable: SwiftDataTable, indexPath: IndexPath)

/// Specify custom heights for specific rows. A row height of 0 is valid and will be used.
@objc optional func dataTable(_ dataTable: SwiftDataTable, heightForRowAt index: Int) -> CGFloat

Expand Down
4 changes: 2 additions & 2 deletions SwiftDataTables.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'SwiftDataTables'
s.version = '0.6.31'
s.version = '0.7.0'
s.summary = 'A Swift Data Table package that allows ordering, searching, and paging with extensible options.'

# This description is used to generate tags and improve search results.
Expand All @@ -28,7 +28,7 @@ Pod::Spec.new do |s|
# s.social_media_url = 'https://twitter.com/pavan_kataria'

s.ios.deployment_target = '8.0'
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.1' }
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.2' }

s.source_files = 'SwiftDataTables/**/*'
# Classes/**/*'
Expand Down
Loading

0 comments on commit 010f691

Please sign in to comment.