Skip to content

Commit 8e2cd89

Browse files
authored
Merge pull request #23 from ethanx94/master
fixed high sierra except for mute button
2 parents e09807a + 8513c60 commit 8e2cd89

File tree

8 files changed

+48
-32
lines changed

8 files changed

+48
-32
lines changed

touchbar_nyancat.xcodeproj/project.pbxproj

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
A362A10D1DCE6D6B00737197 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A362A10B1DCE6D6B00737197 /* Main.storyboard */; };
1616
A3826CDA1DCE79B900B7C41E /* NyanCatCanvas.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3826CD91DCE79B900B7C41E /* NyanCatCanvas.swift */; };
1717
A3826CDC1DCE7B5000B7C41E /* NyanCatCanvas.xib in Resources */ = {isa = PBXBuildFile; fileRef = A3826CDB1DCE7B5000B7C41E /* NyanCatCanvas.xib */; };
18+
F3D5DE841F8AE06D00AD4767 /* nyan_music.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = F3D5DE831F8AE00200AD4767 /* nyan_music.mp3 */; };
19+
F3D5DE861F8AE13A00AD4767 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = F3D5DE851F8AE11900AD4767 /* icon.png */; };
20+
F3D5DE881F8AE20700AD4767 /* AppIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = F3D5DE871F8AE1FD00AD4767 /* AppIcon.icns */; };
1821
/* End PBXBuildFile section */
1922

2023
/* Begin PBXFileReference section */
@@ -28,6 +31,9 @@
2831
A362A10E1DCE6D6B00737197 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
2932
A3826CD91DCE79B900B7C41E /* NyanCatCanvas.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NyanCatCanvas.swift; sourceTree = "<group>"; };
3033
A3826CDB1DCE7B5000B7C41E /* NyanCatCanvas.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NyanCatCanvas.xib; sourceTree = "<group>"; };
34+
F3D5DE831F8AE00200AD4767 /* nyan_music.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = nyan_music.mp3; sourceTree = "<group>"; };
35+
F3D5DE851F8AE11900AD4767 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
36+
F3D5DE871F8AE1FD00AD4767 /* AppIcon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon.icns; sourceTree = "<group>"; };
3137
/* End PBXFileReference section */
3238

3339
/* Begin PBXFrameworksBuildPhase section */
@@ -67,6 +73,7 @@
6773
A3826CD91DCE79B900B7C41E /* NyanCatCanvas.swift */,
6874
A3826CDB1DCE7B5000B7C41E /* NyanCatCanvas.xib */,
6975
A362A1091DCE6D6B00737197 /* Assets.xcassets */,
76+
F3D5DE871F8AE1FD00AD4767 /* AppIcon.icns */,
7077
A362A10B1DCE6D6B00737197 /* Main.storyboard */,
7178
A362A10E1DCE6D6B00737197 /* Info.plist */,
7279
);
@@ -76,6 +83,7 @@
7683
A3826CD61DCE73EA00B7C41E /* img */ = {
7784
isa = PBXGroup;
7885
children = (
86+
F3D5DE851F8AE11900AD4767 /* icon.png */,
7987
A34053A11DCF56600081ABF1 /* ic_volume_off_3x.png */,
8088
A34053A31DCF56640081ABF1 /* ic_volume_up_3x.png */,
8189
);
@@ -85,6 +93,7 @@
8593
A3A050DA1DCE96B2009D9775 /* sound */ = {
8694
isa = PBXGroup;
8795
children = (
96+
F3D5DE831F8AE00200AD4767 /* nyan_music.mp3 */,
8897
);
8998
name = sound;
9099
sourceTree = "<group>";
@@ -121,7 +130,8 @@
121130
TargetAttributes = {
122131
A362A1011DCE6D6B00737197 = {
123132
CreatedOnToolsVersion = 8.1;
124-
DevelopmentTeam = 9K2GY8824J;
133+
DevelopmentTeam = CW482378P7;
134+
LastSwiftMigration = 0900;
125135
ProvisioningStyle = Automatic;
126136
};
127137
};
@@ -149,6 +159,9 @@
149159
isa = PBXResourcesBuildPhase;
150160
buildActionMask = 2147483647;
151161
files = (
162+
F3D5DE881F8AE20700AD4767 /* AppIcon.icns in Resources */,
163+
F3D5DE861F8AE13A00AD4767 /* icon.png in Resources */,
164+
F3D5DE841F8AE06D00AD4767 /* nyan_music.mp3 in Resources */,
152165
A3826CDC1DCE7B5000B7C41E /* NyanCatCanvas.xib in Resources */,
153166
A362A10A1DCE6D6B00737197 /* Assets.xcassets in Resources */,
154167
A362A10D1DCE6D6B00737197 /* Main.storyboard in Resources */,
@@ -280,12 +293,12 @@
280293
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
281294
CODE_SIGN_IDENTITY = "Mac Developer";
282295
COMBINE_HIDPI_IMAGES = YES;
283-
DEVELOPMENT_TEAM = 9K2GY8824J;
296+
DEVELOPMENT_TEAM = CW482378P7;
284297
INFOPLIST_FILE = touchbar_nyancat/Info.plist;
285298
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
286299
PRODUCT_BUNDLE_IDENTIFIER = "com.vatsaev.touchbar-nyancat";
287300
PRODUCT_NAME = "$(TARGET_NAME)";
288-
SWIFT_VERSION = 3.0;
301+
SWIFT_VERSION = 4.0;
289302
};
290303
name = Debug;
291304
};
@@ -295,12 +308,12 @@
295308
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
296309
CODE_SIGN_IDENTITY = "Mac Developer";
297310
COMBINE_HIDPI_IMAGES = YES;
298-
DEVELOPMENT_TEAM = 9K2GY8824J;
311+
DEVELOPMENT_TEAM = CW482378P7;
299312
INFOPLIST_FILE = touchbar_nyancat/Info.plist;
300313
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
301314
PRODUCT_BUNDLE_IDENTIFIER = "com.vatsaev.touchbar-nyancat";
302315
PRODUCT_NAME = "$(TARGET_NAME)";
303-
SWIFT_VERSION = 3.0;
316+
SWIFT_VERSION = 4.0;
304317
};
305318
name = Release;
306319
};

touchbar_nyancat/AppIcon.icns

426 KB
Binary file not shown.

touchbar_nyancat/Base.lproj/Main.storyboard

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2659" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
33
<dependencies>
44
<deployment identifier="macosx"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaDFRPlugin" version="7104"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaDFRPlugin" version="13038"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13196"/>
77
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
8-
<capability name="the Touch Bar" message="Use a version of macOS with Touch Bar support." minToolsVersion="8.1" minSystemVersion="10.12.1" requiredIntegratedClassName="NSTouchBar"/>
8+
<capability name="the Touch Bar" message="Use a version of macOS with Touch Bar support." minToolsVersion="8.1" minSystemVersion="10.12.2" requiredIntegratedClassName="NSTouchBar"/>
99
</dependencies>
1010
<scenes>
1111
<!--Window Controller-->
@@ -19,6 +19,9 @@
1919
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1028"/>
2020
<value key="minSize" type="size" width="480" height="270"/>
2121
<value key="maxSize" type="size" width="480" height="270"/>
22+
<connections>
23+
<outlet property="delegate" destination="B8D-0N-5wS" id="Qm7-gy-puM"/>
24+
</connections>
2225
</window>
2326
<touchBar key="touchBar" id="xmN-zC-h8c">
2427
<touchBarItems>

touchbar_nyancat/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>CFBundleExecutable</key>
88
<string>$(EXECUTABLE_NAME)</string>
99
<key>CFBundleIconFile</key>
10-
<string></string>
10+
<string>AppIcon.icns</string>
1111
<key>CFBundleIdentifier</key>
1212
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
1313
<key>CFBundleInfoDictionaryVersion</key>

touchbar_nyancat/NyanCatCanvas.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
import Cocoa
1010

1111
class NyanCatCanvas: NSImageView {
12-
var timer:Timer? = nil
12+
@objc var timer:Timer? = nil
1313

14-
var imageLoaded:Bool = false;
14+
@objc var imageLoaded:Bool = false;
1515

16-
var xPosition: CGFloat = -680 {
16+
@objc var xPosition: CGFloat = -680 {
1717
didSet {
1818
self.frame = CGRect(x: xPosition, y: 0, width: 680, height: 30)
1919
}
@@ -47,13 +47,13 @@ class NyanCatCanvas: NSImageView {
4747

4848
}
4949

50-
public func moveNyancat() {
50+
@objc public func moveNyancat() {
5151
if (xPosition < 0) {
5252
xPosition += 1
5353
}
5454
}
5555

56-
func downloadImage() {
56+
@objc func downloadImage() {
5757

5858
let url = URL(string: "https://i.imgur.com/7pgdK28.gif")
5959

@@ -67,7 +67,7 @@ class NyanCatCanvas: NSImageView {
6767
}
6868
}
6969

70-
func getDataFromUrl(url: URL, completion: @escaping (_ data: Data?, _ response: URLResponse?, _ error: Error?) -> Void) {
70+
@objc func getDataFromUrl(url: URL, completion: @escaping (_ data: Data?, _ response: URLResponse?, _ error: Error?) -> Void) {
7171
URLSession.shared.dataTask(with: url) {
7272
(data, response, error) in
7373
completion(data, response, error)

touchbar_nyancat/NyanCatViewController.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import AVFoundation
1313

1414
class NyanCatViewController: NSViewController , NSTouchBarDelegate{
1515

16-
var audio_player: AVAudioPlayer?
16+
@objc var audio_player: AVAudioPlayer?
1717

1818
@IBOutlet weak var muteBtn: NSButton!
1919
//NOTE: I fucking love Swift's computed properties!
20-
var sound: Bool = true {
20+
@objc var sound: Bool = true {
2121

2222
didSet{
2323

@@ -33,8 +33,8 @@ class NyanCatViewController: NSViewController , NSTouchBarDelegate{
3333

3434
}
3535

36-
var sound_btn_image_on: NSImage?
37-
var sound_btn_image_off: NSImage?
36+
@objc var sound_btn_image_on: NSImage?
37+
@objc var sound_btn_image_off: NSImage?
3838

3939
@IBOutlet weak var sound_btn: NSButtonCell!
4040
@IBOutlet weak var bkg: NSView!
@@ -59,21 +59,21 @@ class NyanCatViewController: NSViewController , NSTouchBarDelegate{
5959

6060
bkg.layer?.backgroundColor = NSColor(red:0.08, green:0.31, blue:0.55, alpha:1.00).cgColor
6161

62-
sound_btn_image_on = NSImage(named: "ic_volume_up_3x.png")
63-
sound_btn_image_off = NSImage(named: "ic_volume_off_3x.png")
62+
sound_btn_image_on = NSImage(named: NSImage.Name(rawValue: "ic_volume_up_3x.png"))
63+
sound_btn_image_off = NSImage(named: NSImage.Name(rawValue: "ic_volume_off_3x.png"))
6464

6565

66-
// let nyan_music = URL(fileURLWithPath: Bundle.main.path(forResource: "nyan_music", ofType: "mp3")!)
67-
//
68-
// do {
69-
//
70-
// try audio_player = AVAudioPlayer(contentsOf: nyan_music)
71-
// audio_player?.numberOfLoops = -1
72-
// audio_player?.prepareToPlay()
73-
//
74-
// }catch{}
66+
let nyan_music = URL(fileURLWithPath: Bundle.main.path(forResource: "nyan_music", ofType: "mp3")!)
7567

76-
//sound = true
68+
do {
69+
70+
try audio_player = AVAudioPlayer(contentsOf: nyan_music)
71+
audio_player?.numberOfLoops = -1
72+
audio_player?.prepareToPlay()
73+
74+
}catch{}
75+
76+
sound = true
7777

7878

7979
}

touchbar_nyancat/icon.png

47.8 KB
Loading

touchbar_nyancat/nyan_music.mp3

3.59 MB
Binary file not shown.

0 commit comments

Comments
 (0)