Skip to content

Commit d450d91

Browse files
committed
add French localization so the French date formatter example works; update dates
1 parent 8ae1150 commit d450d91

File tree

5 files changed

+106
-8
lines changed

5 files changed

+106
-8
lines changed

bk1ch10p428foundationClasses/bk1ch10p428foundationClasses.xcodeproj/project.pbxproj

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
32B16F051AFEA63C00E98CCB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
2323
32B16F071AFEA63C00E98CCB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
2424
32B16F0A1AFEA63C00E98CCB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
25+
81D6069A22D52254008FBEC9 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Main.strings; sourceTree = "<group>"; };
26+
81D6069B22D52254008FBEC9 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
2527
/* End PBXFileReference section */
2628

2729
/* Begin PBXFrameworksBuildPhase section */
@@ -108,6 +110,7 @@
108110
English,
109111
en,
110112
Base,
113+
fr,
111114
);
112115
mainGroup = 32B16EF21AFEA63C00E98CCB;
113116
productRefGroup = 32B16EFC1AFEA63C00E98CCB /* Products */;
@@ -149,6 +152,7 @@
149152
isa = PBXVariantGroup;
150153
children = (
151154
32B16F051AFEA63C00E98CCB /* Base */,
155+
81D6069A22D52254008FBEC9 /* fr */,
152156
);
153157
name = Main.storyboard;
154158
sourceTree = "<group>";
@@ -157,6 +161,7 @@
157161
isa = PBXVariantGroup;
158162
children = (
159163
32B16F0A1AFEA63C00E98CCB /* Base */,
164+
81D6069B22D52254008FBEC9 /* fr */,
160165
);
161166
name = LaunchScreen.xib;
162167
sourceTree = "<group>";
@@ -200,7 +205,7 @@
200205
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
201206
GCC_WARN_UNUSED_FUNCTION = YES;
202207
GCC_WARN_UNUSED_VARIABLE = YES;
203-
IPHONEOS_DEPLOYMENT_TARGET = 12.2;
208+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
204209
MTL_ENABLE_DEBUG_INFO = YES;
205210
ONLY_ACTIVE_ARCH = YES;
206211
SDKROOT = iphoneos;
@@ -238,7 +243,7 @@
238243
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
239244
GCC_WARN_UNUSED_FUNCTION = YES;
240245
GCC_WARN_UNUSED_VARIABLE = YES;
241-
IPHONEOS_DEPLOYMENT_TARGET = 12.2;
246+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
242247
MTL_ENABLE_DEBUG_INFO = NO;
243248
SDKROOT = iphoneos;
244249
VALIDATE_PRODUCT = YES;
@@ -250,6 +255,7 @@
250255
buildSettings = {
251256
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
252257
INFOPLIST_FILE = bk1ch10p428foundationClasses/Info.plist;
258+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
253259
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
254260
PRODUCT_NAME = "$(TARGET_NAME)";
255261
SWIFT_VERSION = 5.0;
@@ -261,6 +267,7 @@
261267
buildSettings = {
262268
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
263269
INFOPLIST_FILE = bk1ch10p428foundationClasses/Info.plist;
270+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
264271
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
265272
PRODUCT_NAME = "$(TARGET_NAME)";
266273
SWIFT_VERSION = 5.0;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1100"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "32B16EFA1AFEA63C00E98CCB"
18+
BuildableName = "bk1ch10p428foundationClasses.app"
19+
BlueprintName = "bk1ch10p428foundationClasses"
20+
ReferencedContainer = "container:bk1ch10p428foundationClasses.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "32B16EFA1AFEA63C00E98CCB"
48+
BuildableName = "bk1ch10p428foundationClasses.app"
49+
BlueprintName = "bk1ch10p428foundationClasses"
50+
ReferencedContainer = "container:bk1ch10p428foundationClasses.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "32B16EFA1AFEA63C00E98CCB"
65+
BuildableName = "bk1ch10p428foundationClasses.app"
66+
BlueprintName = "bk1ch10p428foundationClasses"
67+
ReferencedContainer = "container:bk1ch10p428foundationClasses.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</ProfileAction>
71+
<AnalyzeAction
72+
buildConfiguration = "Debug">
73+
</AnalyzeAction>
74+
<ArchiveAction
75+
buildConfiguration = "Release"
76+
revealArchiveInOrganizer = "YES">
77+
</ArchiveAction>
78+
</Scheme>

bk1ch10p428foundationClasses/bk1ch10p428foundationClasses/ViewController.swift

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,18 @@ class Dog2 : NSObject { // a dog equatable and hashable on its name
3232
}
3333
}
3434

35-
35+
// illegal: you can get autosynthesis of Equatable because it's _already_ Equatable
36+
// and anyhow you can't get autosynthesis for classes
37+
/*
38+
class Dog3 : NSObject, Equatable {
39+
var name : String
40+
var license : Int
41+
init(name:String, license:Int) {
42+
self.name = name
43+
self.license = license
44+
}
45+
}
46+
*/
3647

3748
class ViewController: UIViewController {
3849

@@ -149,7 +160,7 @@ class ViewController: UIViewController {
149160

150161
do {
151162
let greg = Calendar(identifier:.gregorian)
152-
let comp = DateComponents(calendar: greg, year: 2018, month: 8, day: 10, hour: 15)
163+
let comp = DateComponents(calendar: greg, year: 2019, month: 8, day: 10, hour: 15)
153164
let d = comp.date // Optional wrapping Date
154165
if let d = d {
155166
print(d)
@@ -171,9 +182,9 @@ class ViewController: UIViewController {
171182
do {
172183
let greg = Calendar(identifier:.gregorian)
173184
let d1 = DateComponents(calendar: greg,
174-
year: 2018, month: 1, day: 1, hour: 0).date!
185+
year: 2019, month: 1, day: 1, hour: 0).date!
175186
let d2 = DateComponents(calendar: greg,
176-
year: 2018, month: 8, day: 10, hour: 15).date!
187+
year: 2019, month: 8, day: 10, hour: 15).date!
177188
let di = DateInterval(start: d1, end: d2)
178189
if di.contains(Date()) { // are we currently between those two dates?
179190
print("yep")
@@ -183,7 +194,7 @@ class ViewController: UIViewController {
183194
do {
184195
let df = DateFormatter()
185196
df.dateFormat = "M/d/y"
186-
let s = df.string(from: Date()) // 7/31/2018
197+
let s = df.string(from: Date()) // 7/31/2019
187198
print(s)
188199
}
189200

@@ -201,7 +212,7 @@ class ViewController: UIViewController {
201212
let df = DateFormatter()
202213
df.locale = Locale(identifier: "en_US_POSIX")
203214
df.dateFormat = "M/d/y"
204-
let d = df.date(from: "31/7/2018")
215+
let d = df.date(from: "14/7/2019")
205216
print(d as Any)
206217
}
207218

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)