Skip to content

Commit

Permalink
Migrated to swift 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Florent Grandjean committed Feb 6, 2020
1 parent 02967f6 commit 3b71a38
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 21 deletions.
15 changes: 9 additions & 6 deletions TouchFart.xcodeproj/project.pbxproj
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 47;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -179,10 +179,11 @@
};
};
buildConfigurationList = 1968E2781DC2E22100422BFE /* Build configuration list for PBXProject "TouchFart" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 6.3";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -359,10 +360,10 @@
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = TouchFart/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_BUNDLE_IDENTIFIER = "com.hung-truong.TouchFart";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -373,10 +374,10 @@
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = TouchFart/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_BUNDLE_IDENTIFIER = "com.hung-truong.TouchFart";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down Expand Up @@ -429,6 +430,7 @@
1968E2991DC2E22100422BFE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1968E29A1DC2E22100422BFE /* Build configuration list for PBXNativeTarget "TouchFartTests" */ = {
isa = XCConfigurationList;
Expand All @@ -437,6 +439,7 @@
1968E29C1DC2E22100422BFE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
@@ -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>
11 changes: 7 additions & 4 deletions TouchFart/Base.lproj/Main.storyboard
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2657" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15705"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -600,7 +600,7 @@
<menuItem title="Show Sidebar" keyEquivalent="s" id="kIP-vf-haE">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleSourceList:" target="Ady-hI-5gd" id="iwa-gc-5KM"/>
<action selector="toggleSidebar:" target="Ady-hI-5gd" id="iwa-gc-5KM"/>
</connections>
</menuItem>
<menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa">
Expand Down Expand Up @@ -664,11 +664,14 @@
<scene sceneID="R2V-B0-nI4">
<objects>
<windowController id="B8D-0N-5wS" customClass="WindowController" customModule="TouchFart" customModuleProvider="target" sceneMemberID="viewController">
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<connections>
<outlet property="delegate" destination="B8D-0N-5wS" id="gxR-hK-XF0"/>
</connections>
</window>
<connections>
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
Expand Down
22 changes: 11 additions & 11 deletions TouchFart/WindowController.swift
Expand Up @@ -8,25 +8,25 @@

import Cocoa

fileprivate extension NSTouchBarCustomizationIdentifier {
static let touchBar = NSTouchBarCustomizationIdentifier("com.hung-truong.touchfart")
fileprivate extension NSTouchBar.CustomizationIdentifier {
static let touchBar = NSTouchBar.CustomizationIdentifier("com.hung-truong.touchfart")
}

fileprivate extension NSTouchBarItemIdentifier {
static let πŸ’© = NSTouchBarItemIdentifier("πŸ’©")
static let πŸ’¨ = NSTouchBarItemIdentifier("πŸ’¨")
static let fart = NSTouchBarItemIdentifier("fart")
static let dry = NSTouchBarItemIdentifier("dry")
static let creamy = NSTouchBarItemIdentifier("creamy")
fileprivate extension NSTouchBarItem.Identifier {
static let πŸ’© = NSTouchBarItem.Identifier("πŸ’©")
static let πŸ’¨ = NSTouchBarItem.Identifier("πŸ’¨")
static let fart = NSTouchBarItem.Identifier("fart")
static let dry = NSTouchBarItem.Identifier("dry")
static let creamy = NSTouchBarItem.Identifier("creamy")
}


class WindowController: NSWindowController, NSTouchBarDelegate {

func handleFart(sender: NSButton) {
@objc func handleFart(sender: NSButton) {
let title = sender.title

guard let sound = NSSound(named: title) else {
guard let sound = NSSound(named: NSSound.Name(rawValue: title)) else {
return
}
sound.play()
Expand All @@ -43,7 +43,7 @@ class WindowController: NSWindowController, NSTouchBarDelegate {
}

@available(OSX 10.12.2, *)
func touchBar(_ touchBar: NSTouchBar, makeItemForIdentifier identifier: NSTouchBarItemIdentifier) -> NSTouchBarItem? {
func touchBar(_ touchBar: NSTouchBar, makeItemForIdentifier identifier: NSTouchBarItem.Identifier) -> NSTouchBarItem? {
let touchBarItem = NSCustomTouchBarItem(identifier: identifier)
touchBarItem.view = NSButton(title: identifier.rawValue, target: self, action: #selector(handleFart))
return touchBarItem
Expand Down

0 comments on commit 3b71a38

Please sign in to comment.