Skip to content

Commit

Permalink
Update Swift 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Cem Olcay committed Jul 29, 2019
1 parent 67642ac commit e913400
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion MIDITimeTableView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "MIDITimeTableView"
s.version = "1.0.2"
s.version = "1.0.3"
s.summary = "Customisable and editable time table grid for showing midi or audio related data with a measure."
s.swift_version = "4.2"

Expand Down
5 changes: 3 additions & 2 deletions MIDITimeTableView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
TargetAttributes = {
B29FB6AA1F923E07006E4EA8 = {
CreatedOnToolsVersion = 9.0;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -341,7 +342,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.cemolcay.MIDITimeTableView;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -357,7 +358,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.cemolcay.MIDITimeTableView;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
10 changes: 7 additions & 3 deletions MIDITimeTableView/Source/MIDITimeTableCellData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ public struct MIDITimeTableCellIndex: Hashable {
public var row: Int
/// Index number in the row. Does not represent column.
public var index: Int
/// Hashable value
public var hashValue: Int

/// Initilizes the index with row and column indices.
///
Expand All @@ -24,7 +22,13 @@ public struct MIDITimeTableCellIndex: Hashable {
public init(row: Int, index: Int) {
self.row = row
self.index = index
hashValue = row.hashValue ^ index.hashValue &* 16777619
}

// MARK: Hashable

public func hash(into hasher: inout Hasher) {
hasher.combine(row)
hasher.combine(index)
}

// MARK: Equatable
Expand Down
2 changes: 1 addition & 1 deletion MIDITimeTableView/Source/MIDITimeTableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ open class MIDITimeTableView: UIScrollView, MIDITimeTableCellViewDelegate, MIDIT
/// - Returns: Returns a row and column index Int pair in a tuple.
public func cellIndex(of cell: MIDITimeTableCellView) -> MIDITimeTableCellIndex? {
let row = Int((cell.frame.minY - measureHeight) / rowHeight)
guard let index = cellViews[row].index(of: cell), row < cellViews.count else { return nil }
guard let index = cellViews[row].firstIndex(of: cell), row < cellViews.count else { return nil }
return MIDITimeTableCellIndex(row: row, index: index)
}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Demo
Requirements
----

- Swift 3+
- Swift 5.0+
- iOS 9.0+

Install
Expand Down

0 comments on commit e913400

Please sign in to comment.