Skip to content

Commit

Permalink
Update Swift 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
cemolcay committed Nov 23, 2018
1 parent 9bebeba commit 67642ac
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 15 deletions.
5 changes: 3 additions & 2 deletions MIDITimeTableView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ Pod::Spec.new do |s|
#

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

# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
Expand All @@ -38,7 +39,7 @@ Demo
Requirements
----
- Swift 3+
- Swift 4.2+
- iOS 9.0+
Install
Expand Down
10 changes: 7 additions & 3 deletions MIDITimeTableView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0900;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = cemolcay;
TargetAttributes = {
B29FB6AA1F923E07006E4EA8 = {
Expand Down Expand Up @@ -233,13 +233,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -290,13 +292,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -337,7 +341,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.cemolcay.MIDITimeTableView;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -353,7 +357,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.cemolcay.MIDITimeTableView;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
3 changes: 1 addition & 2 deletions MIDITimeTableView/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
2 changes: 1 addition & 1 deletion MIDITimeTableView/Source/MIDITimeTableCellView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ open class MIDITimeTableCellView: UIView {

NotificationCenter.default.addObserver(self,
selector: #selector(menuControllerWillHideNotification),
name: .UIMenuControllerWillHideMenu,
name: UIMenuController.willHideMenuNotification,
object: nil)
}

Expand Down
2 changes: 1 addition & 1 deletion MIDITimeTableView/Source/MIDITimeTableMeasureLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ open class MIDITimeTableMeasureLayer: CALayer {
textLayer.fontSize = frame.height/2
textLayer.foregroundColor = tintColor.cgColor
textLayer.contentsScale = UIScreen.main.scale
textLayer.alignmentMode = kCAAlignmentLeft
textLayer.alignmentMode = .left
textLayer.string = showsBarNumber ? "\(barNumber)" : ""
// Shape layer
shapeLayer.frame = CGRect(x: 0, y: 0, width: frame.width, height: frame.height)
Expand Down
18 changes: 12 additions & 6 deletions MIDITimeTableView/Source/MIDITimeTableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ open class MIDITimeTableView: UIScrollView, MIDITimeTableCellViewDelegate, MIDIT
rangeheadView.lineHeight = contentSize.height - measureHeight
rangeheadView.measureBeatWidth = measureWidth / CGFloat(measureView.beatCount)
rangeheadView.isHidden = !showsPlayhead
bringSubview(toFront: rangeheadView)
bringSubviewToFront(rangeheadView)

// Grid layer
gridLayer.rowCount = rowHeaderCellViews.count
Expand Down Expand Up @@ -613,13 +613,16 @@ open class MIDITimeTableView: UIScrollView, MIDITimeTableCellViewDelegate, MIDIT

public func midiTimeTableCellViewDidMove(_ midiTimeTableCellView: MIDITimeTableCellView, pan: UIPanGestureRecognizer) {
let translation = pan.translation(in: self)
bringSubview(toFront: midiTimeTableCellView)
bringSubviewToFront(midiTimeTableCellView)

let selectedCells = cellViews.flatMap({ $0 }).filter({ $0.isSelected })

if case .began = pan.state {
midiTimeTableCellView.isSelected = true
editingCellIndices = cellViews.flatMap({ $0 }).filter({ $0.isSelected }).flatMap({ cellIndex(of: $0) })
editingCellIndices = cellViews
.flatMap({ $0 })
.filter({ $0.isSelected })
.compactMap({ cellIndex(of: $0) })
}

isMoving = true
Expand Down Expand Up @@ -660,14 +663,17 @@ open class MIDITimeTableView: UIScrollView, MIDITimeTableCellViewDelegate, MIDIT

public func midiTimeTableCellViewDidResize(_ midiTimeTableCellView: MIDITimeTableCellView, pan: UIPanGestureRecognizer) {
let translation = pan.translation(in: self)
bringSubview(toFront: midiTimeTableCellView)
bringSubviewToFront(midiTimeTableCellView)

let selectedCells = cellViews.flatMap({ $0 }).filter({ $0.isSelected })

if case .began = pan.state {
isResizing = true
midiTimeTableCellView.isSelected = true
editingCellIndices = cellViews.flatMap({ $0 }).filter({ $0.isSelected }).flatMap({ cellIndex(of: $0) })
editingCellIndices = cellViews
.flatMap({ $0 })
.filter({ $0.isSelected })
.compactMap({ cellIndex(of: $0) })
}

for cell in selectedCells {
Expand Down Expand Up @@ -716,7 +722,7 @@ open class MIDITimeTableView: UIScrollView, MIDITimeTableCellViewDelegate, MIDIT
let deletingCellIndices = cellViews
.flatMap({ $0 })
.filter({ $0.isSelected })
.flatMap({ cellIndex(of: $0) })
.compactMap({ cellIndex(of: $0) })
timeTableDelegate?.midiTimeTableView(self, didDelete: deletingCellIndices)
}

Expand Down

0 comments on commit 67642ac

Please sign in to comment.