1
0
mirror of https://github.com/Toxblh/MTMR.git synced 2026-01-10 17:08:39 +00:00

removed all warnings

This commit is contained in:
Toxblh 2018-04-14 00:02:19 +01:00
parent 0e07f71458
commit 877c4268fd
3 changed files with 6 additions and 7 deletions

View File

@ -25,27 +25,26 @@ class HapticFeedback {
// you can get a plist `otool -s __TEXT __tpad_act_plist /System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/Current/MultitouchSupport|tail -n +3|awk -F'\t' '{print $2}'|xxd -r -p`
func tap(strong:Int32) -> Void {
let actuatorRef = MTActuatorCreateFromDeviceID(deviceID).takeRetainedValue()
actuatorRef = MTActuatorCreateFromDeviceID(deviceID).takeRetainedValue()
// TODO: Need to fix warning
guard actuatorRef != nil else {
print("guard actuatorRef == nil")
return
}
error = MTActuatorOpen(actuatorRef)
error = MTActuatorOpen(actuatorRef!)
guard error == kIOReturnSuccess else {
print("guard MTActuatorOpen")
return
}
error = MTActuatorActuate(actuatorRef, strong, 0, 0.0, 0.0)
error = MTActuatorActuate(actuatorRef!, strong, 0, 0.0, 0.0)
guard error == kIOReturnSuccess else {
print("guard MTActuatorActuate")
return
}
error = MTActuatorClose(actuatorRef)
error = MTActuatorClose(actuatorRef!)
guard error == kIOReturnSuccess else {
print("guard MTActuatorClose")
return

View File

@ -4,7 +4,7 @@ class ScrollViewItem: NSCustomTouchBarItem {
init(identifier: NSTouchBarItem.Identifier, items: [NSTouchBarItem]) {
super.init(identifier: identifier)
let views = items.flatMap { $0.view }
let views = items.compactMap { $0.view }
let stackView = NSStackView(views: views)
stackView.orientation = .horizontal
let scrollView = NSScrollView(frame: CGRect(origin: .zero, size: stackView.fittingSize))

View File

@ -57,7 +57,7 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
loadItemDefinitions()
createItems()
centerItems = self.itemDefinitions.flatMap { (identifier, definition) -> NSTouchBarItem? in
centerItems = self.itemDefinitions.compactMap { (identifier, definition) -> NSTouchBarItem? in
return definition.align == .center ? items[identifier] : nil
}