Skip to content

Commit f917e1e

Browse files
Improvements for v1.1.0
1 parent 064a63e commit f917e1e

14 files changed

Lines changed: 989 additions & 856 deletions

File tree

.DS_Store

0 Bytes
Binary file not shown.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ modules.order
5050
Module.symvers
5151
Mkfile.old
5252
dkms.conf
53+
.DS_Store

WorldClock.xcodeproj/project.pbxproj

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
3E0D063027F25F5D0026A36C /* ClockEditContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E0D062F27F25F5D0026A36C /* ClockEditContext.swift */; };
1011
3E88E31327E1043E004677DA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E88E31227E1043E004677DA /* AppDelegate.swift */; };
1112
3E88E31527E1043E004677DA /* ClocksViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E88E31427E1043E004677DA /* ClocksViewController.swift */; };
1213
3E88E31727E1043F004677DA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3E88E31627E1043F004677DA /* Assets.xcassets */; };
1314
3E88E31A27E1043F004677DA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3E88E31827E1043F004677DA /* Main.storyboard */; };
1415
3E88E32227E1051C004677DA /* Clock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E88E32127E1051C004677DA /* Clock.swift */; };
1516
3E88E32727E13300004677DA /* WCTimeZone.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E88E32627E13300004677DA /* WCTimeZone.swift */; };
16-
3E88E32927E1340A004677DA /* AddClockViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E88E32827E1340A004677DA /* AddClockViewController.swift */; };
17+
3E88E32927E1340A004677DA /* ClockEditorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E88E32827E1340A004677DA /* ClockEditorViewController.swift */; };
1718
3E88E32B27E1376B004677DA /* WorldClocks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E88E32A27E1376B004677DA /* WorldClocks.swift */; };
1819
3EDF755227E24F1700E28689 /* WCTimeZone+Presets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EDF755127E24F1700E28689 /* WCTimeZone+Presets.swift */; };
1920
/* End PBXBuildFile section */
2021

2122
/* Begin PBXFileReference section */
23+
3E0D062F27F25F5D0026A36C /* ClockEditContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClockEditContext.swift; sourceTree = "<group>"; };
2224
3E88E30F27E1043E004677DA /* WorldClock.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WorldClock.app; sourceTree = BUILT_PRODUCTS_DIR; };
2325
3E88E31227E1043E004677DA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
2426
3E88E31427E1043E004677DA /* ClocksViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClocksViewController.swift; sourceTree = "<group>"; };
@@ -27,7 +29,7 @@
2729
3E88E31B27E1043F004677DA /* WorldClock.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = WorldClock.entitlements; sourceTree = "<group>"; };
2830
3E88E32127E1051C004677DA /* Clock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Clock.swift; sourceTree = "<group>"; };
2931
3E88E32627E13300004677DA /* WCTimeZone.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WCTimeZone.swift; sourceTree = "<group>"; };
30-
3E88E32827E1340A004677DA /* AddClockViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddClockViewController.swift; sourceTree = "<group>"; };
32+
3E88E32827E1340A004677DA /* ClockEditorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClockEditorViewController.swift; sourceTree = "<group>"; };
3133
3E88E32A27E1376B004677DA /* WorldClocks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorldClocks.swift; sourceTree = "<group>"; };
3234
3EDF755127E24F1700E28689 /* WCTimeZone+Presets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WCTimeZone+Presets.swift"; sourceTree = "<group>"; };
3335
/* End PBXFileReference section */
@@ -43,6 +45,34 @@
4345
/* End PBXFrameworksBuildPhase section */
4446

4547
/* Begin PBXGroup section */
48+
3E0D063127F262770026A36C /* ViewControllers */ = {
49+
isa = PBXGroup;
50+
children = (
51+
3E88E31427E1043E004677DA /* ClocksViewController.swift */,
52+
3E88E32827E1340A004677DA /* ClockEditorViewController.swift */,
53+
);
54+
path = ViewControllers;
55+
sourceTree = "<group>";
56+
};
57+
3E0D063227F262A90026A36C /* Model */ = {
58+
isa = PBXGroup;
59+
children = (
60+
3E88E32127E1051C004677DA /* Clock.swift */,
61+
3E88E32627E13300004677DA /* WCTimeZone.swift */,
62+
3EDF755127E24F1700E28689 /* WCTimeZone+Presets.swift */,
63+
3E88E32A27E1376B004677DA /* WorldClocks.swift */,
64+
);
65+
path = Model;
66+
sourceTree = "<group>";
67+
};
68+
3E0D063327F262C90026A36C /* Utils */ = {
69+
isa = PBXGroup;
70+
children = (
71+
3E0D062F27F25F5D0026A36C /* ClockEditContext.swift */,
72+
);
73+
path = Utils;
74+
sourceTree = "<group>";
75+
};
4676
3E88E30627E1043E004677DA = {
4777
isa = PBXGroup;
4878
children = (
@@ -62,16 +92,13 @@
6292
3E88E31127E1043E004677DA /* WorldClock */ = {
6393
isa = PBXGroup;
6494
children = (
95+
3E88E31827E1043F004677DA /* Main.storyboard */,
6596
3E88E31227E1043E004677DA /* AppDelegate.swift */,
66-
3E88E31427E1043E004677DA /* ClocksViewController.swift */,
97+
3E0D063227F262A90026A36C /* Model */,
98+
3E0D063127F262770026A36C /* ViewControllers */,
99+
3E0D063327F262C90026A36C /* Utils */,
67100
3E88E31627E1043F004677DA /* Assets.xcassets */,
68-
3E88E31827E1043F004677DA /* Main.storyboard */,
69101
3E88E31B27E1043F004677DA /* WorldClock.entitlements */,
70-
3E88E32127E1051C004677DA /* Clock.swift */,
71-
3E88E32627E13300004677DA /* WCTimeZone.swift */,
72-
3EDF755127E24F1700E28689 /* WCTimeZone+Presets.swift */,
73-
3E88E32827E1340A004677DA /* AddClockViewController.swift */,
74-
3E88E32A27E1376B004677DA /* WorldClocks.swift */,
75102
);
76103
path = WorldClock;
77104
sourceTree = "<group>";
@@ -150,12 +177,13 @@
150177
isa = PBXSourcesBuildPhase;
151178
buildActionMask = 2147483647;
152179
files = (
180+
3E0D063027F25F5D0026A36C /* ClockEditContext.swift in Sources */,
153181
3E88E32727E13300004677DA /* WCTimeZone.swift in Sources */,
154182
3E88E32B27E1376B004677DA /* WorldClocks.swift in Sources */,
155183
3EDF755227E24F1700E28689 /* WCTimeZone+Presets.swift in Sources */,
156184
3E88E32227E1051C004677DA /* Clock.swift in Sources */,
157185
3E88E31527E1043E004677DA /* ClocksViewController.swift in Sources */,
158-
3E88E32927E1340A004677DA /* AddClockViewController.swift in Sources */,
186+
3E88E32927E1340A004677DA /* ClockEditorViewController.swift in Sources */,
159187
3E88E31327E1043E004677DA /* AppDelegate.swift in Sources */,
160188
);
161189
runOnlyForDeploymentPostprocessing = 0;
@@ -297,7 +325,7 @@
297325
CODE_SIGN_ENTITLEMENTS = WorldClock/WorldClock.entitlements;
298326
CODE_SIGN_STYLE = Automatic;
299327
COMBINE_HIDPI_IMAGES = YES;
300-
CURRENT_PROJECT_VERSION = 1.0.0;
328+
CURRENT_PROJECT_VERSION = 1.1.0;
301329
DEVELOPMENT_TEAM = C4YUF2G676;
302330
ENABLE_HARDENED_RUNTIME = YES;
303331
GENERATE_INFOPLIST_FILE = YES;
@@ -309,7 +337,7 @@
309337
"@executable_path/../Frameworks",
310338
);
311339
MACOSX_DEPLOYMENT_TARGET = 10.12;
312-
MARKETING_VERSION = 1.0.0;
340+
MARKETING_VERSION = 1.1.0;
313341
PRODUCT_BUNDLE_IDENTIFIER = com.kv.WorldClock;
314342
PRODUCT_NAME = "$(TARGET_NAME)";
315343
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -325,7 +353,7 @@
325353
CODE_SIGN_ENTITLEMENTS = WorldClock/WorldClock.entitlements;
326354
CODE_SIGN_STYLE = Automatic;
327355
COMBINE_HIDPI_IMAGES = YES;
328-
CURRENT_PROJECT_VERSION = 1.0.0;
356+
CURRENT_PROJECT_VERSION = 1.1.0;
329357
DEVELOPMENT_TEAM = C4YUF2G676;
330358
ENABLE_HARDENED_RUNTIME = YES;
331359
GENERATE_INFOPLIST_FILE = YES;
@@ -337,7 +365,7 @@
337365
"@executable_path/../Frameworks",
338366
);
339367
MACOSX_DEPLOYMENT_TARGET = 10.12;
340-
MARKETING_VERSION = 1.0.0;
368+
MARKETING_VERSION = 1.1.0;
341369
PRODUCT_BUNDLE_IDENTIFIER = com.kv.WorldClock;
342370
PRODUCT_NAME = "$(TARGET_NAME)";
343371
SWIFT_EMIT_LOC_STRINGS = YES;

WorldClock/AppDelegate.swift

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,22 @@ class AppDelegate: NSObject, NSApplicationDelegate {
2424
showSettings()
2525
}
2626

27-
NotificationCenter.default.addObserver(self, selector: #selector(self.updateClocks), name: Notification.Name("updateClocks"), object: nil)
27+
NotificationCenter.default.addObserver(self, selector: #selector(self.clocksUpdated), name: Notification.Name("updateClocks"), object: nil)
2828
}
2929

3030
func applicationWillTerminate(_ aNotification: Notification) {
3131
WorldClocks.shared.save()
3232
}
3333

34-
@objc func showClocksInMenuBar() {
34+
private var appVersion: String? {Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String}
35+
36+
private func showClocksInMenuBar() {
37+
38+
if let appVersion = self.appVersion {
39+
statusItem.toolTip = "World Clock v\(appVersion)"
40+
} else {
41+
statusItem.toolTip = "World Clock"
42+
}
3543

3644
statusItem.menu = NSMenu()
3745

@@ -54,7 +62,13 @@ class AppDelegate: NSObject, NSApplicationDelegate {
5462
updateClocks()
5563
}
5664

57-
@objc private func updateClocks() {
65+
@objc private func clocksUpdated() {
66+
67+
updateClocks()
68+
WorldClocks.shared.save()
69+
}
70+
71+
private func updateClocks() {
5872

5973
guard worldClocks.numberOfClocks > 0 else {
6074

WorldClock/Base.lproj/Main.storyboard

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -874,18 +874,18 @@
874874
</tableHeaderView>
875875
</scrollView>
876876
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ol9-bo-C6L">
877-
<rect key="frame" x="14" y="138" width="56" height="19"/>
877+
<rect key="frame" x="84" y="138" width="56" height="19"/>
878878
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
879879
<buttonCell key="cell" type="roundRect" title="Add" bezelStyle="roundedRect" image="plus" catalog="system" imagePosition="left" alignment="right" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Bxt-vW-TxS">
880880
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
881881
<font key="font" metaFont="cellTitle"/>
882882
</buttonCell>
883883
<connections>
884-
<segue destination="VPn-2Y-ept" kind="show" id="PLl-YR-Ivh"/>
884+
<segue destination="VPn-2Y-ept" kind="show" identifier="EditClockSegue" id="PLl-YR-Ivh"/>
885885
</connections>
886886
</button>
887887
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="o3c-tC-SaI">
888-
<rect key="frame" x="77" y="138" width="78" height="19"/>
888+
<rect key="frame" x="147" y="138" width="78" height="19"/>
889889
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
890890
<buttonCell key="cell" type="roundRect" title="Remove" bezelStyle="roundedRect" image="minus" catalog="system" imagePosition="left" alignment="right" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="BD8-Uu-lkn">
891891
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -896,7 +896,7 @@
896896
</connections>
897897
</button>
898898
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6Ug-i8-D8c">
899-
<rect key="frame" x="163" y="138" width="78" height="19"/>
899+
<rect key="frame" x="240" y="138" width="78" height="19"/>
900900
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
901901
<buttonCell key="cell" type="roundRect" title="Move up" bezelStyle="roundedRect" image="arrow.up" catalog="system" imagePosition="left" alignment="right" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="op2-10-ua5">
902902
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -967,7 +967,7 @@ Gw
967967
</connections>
968968
</popUpButton>
969969
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uas-yN-Tec">
970-
<rect key="frame" x="249" y="138" width="97" height="19"/>
970+
<rect key="frame" x="326" y="138" width="97" height="19"/>
971971
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
972972
<buttonCell key="cell" type="roundRect" title="Move down" bezelStyle="roundedRect" image="arrow.down" catalog="system" imagePosition="left" alignment="right" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="3cj-4i-d2A">
973973
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -977,6 +977,17 @@ Gw
977977
<action selector="moveClockDownAction:" target="XfG-lQ-9wD" id="UwF-XY-FgV"/>
978978
</connections>
979979
</button>
980+
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Jlk-bR-sIr">
981+
<rect key="frame" x="14" y="138" width="55" height="19"/>
982+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
983+
<buttonCell key="cell" type="roundRect" title="Edit" bezelStyle="roundedRect" image="pencil" catalog="system" imagePosition="left" alignment="right" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Kpt-Rn-uPL">
984+
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
985+
<font key="font" metaFont="cellTitle"/>
986+
</buttonCell>
987+
<connections>
988+
<action selector="editClockAction:" target="XfG-lQ-9wD" id="fvf-nR-rp3"/>
989+
</connections>
990+
</button>
980991
</subviews>
981992
</view>
982993
<connections>
@@ -991,7 +1002,7 @@ Gw
9911002
<!--Window Controller-->
9921003
<scene sceneID="KVV-ZH-zoC">
9931004
<objects>
994-
<windowController id="VPn-2Y-ept" sceneMemberID="viewController">
1005+
<windowController storyboardIdentifier="ClockEditorWindowController" showSeguePresentationStyle="single" id="VPn-2Y-ept" sceneMemberID="viewController">
9951006
<window key="window" title="Add a clock" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="lUd-JS-RSL">
9961007
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
9971008
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
@@ -1013,10 +1024,10 @@ Gw
10131024
</objects>
10141025
<point key="canvasLocation" x="769" y="250"/>
10151026
</scene>
1016-
<!--Add Clock View Controller-->
1027+
<!--Clock Editor View Controller-->
10171028
<scene sceneID="TM2-O9-Bka">
10181029
<objects>
1019-
<viewController id="iyt-kN-Go5" customClass="AddClockViewController" customModule="WorldClock" customModuleProvider="target" sceneMemberID="viewController">
1030+
<viewController id="iyt-kN-Go5" customClass="ClockEditorViewController" customModule="WorldClock" customModuleProvider="target" sceneMemberID="viewController">
10201031
<view key="view" id="woy-Vu-ibP">
10211032
<rect key="frame" x="0.0" y="0.0" width="624" height="223"/>
10221033
<autoresizingMask key="autoresizingMask"/>
@@ -1027,6 +1038,9 @@ Gw
10271038
<buttonCell key="cell" type="push" title="Save" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="KeE-rS-uIn">
10281039
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
10291040
<font key="font" metaFont="system"/>
1041+
<string key="keyEquivalent" base64-UTF8="YES">
1042+
DQ
1043+
</string>
10301044
</buttonCell>
10311045
<connections>
10321046
<action selector="saveAction:" target="iyt-kN-Go5" id="Alx-fb-rnc"/>
@@ -1105,6 +1119,7 @@ Gw
11051119
<image name="arrow.down" catalog="system" width="13" height="14"/>
11061120
<image name="arrow.up" catalog="system" width="13" height="14"/>
11071121
<image name="minus" catalog="system" width="14" height="4"/>
1122+
<image name="pencil" catalog="system" width="14" height="13"/>
11081123
<image name="plus" catalog="system" width="14" height="13"/>
11091124
</resources>
11101125
</document>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ class Clock: Codable {
3434

3535
func time(for date: Date) -> String {
3636

37+
formatter.timeZone = zone.timeZone
3738
formatter.dateFormat = Self.format.formatString
39+
3840
return "\(name): \(formatter.string(from: date))"
3941
}
4042
}

0 commit comments

Comments
 (0)