Skip to content

Commit 84fe097

Browse files
committed
correct main.swift example, add example of app without interface files
1 parent 1de777b commit 84fe097

File tree

12 files changed

+460
-1
lines changed

12 files changed

+460
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
},
6+
"properties" : {
7+
"provides-namespace" : true
8+
}
9+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
},
6+
"data" : [
7+
{
8+
"idiom" : "universal",
9+
"filename" : "theme.mp3",
10+
"universal-type-identifier" : "public.mp3"
11+
}
12+
]
13+
}
Binary file not shown.

bk1ch06p297main/bk1ch06p297main/MyViewController.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,23 @@
22

33
import UIKit
44
import Coolness
5+
import AVFoundation
56

67
class MyViewController: UIViewController {
8+
9+
var player : AVAudioPlayer!
710

811
override func viewDidLoad() {
912
super.viewDidLoad()
1013

1114
let d = Dog()
1215
d.bark()
16+
17+
// demonstrate use of an asset catalog for miscellaneous resource
18+
// also demonstrate asset catalog "namespace"
19+
let theme = NSDataAsset(name: "music/theme")!
20+
self.player = try! AVAudioPlayer(data: theme.data)
21+
self.player.play()
1322
}
1423

1524
}

bk1ch06p297main/bk1ch06p297main/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ import UIKit
3131
// Jordan Rose at Apple says to use this:
3232

3333
UIApplicationMain(
34-
Process.argc, UnsafeMutablePointer<UnsafeMutablePointer<CChar>>(Process.unsafeArgv), nil, NSStringFromClass(AppDelegate)
34+
Process.argc, UnsafeMutablePointer<UnsafeMutablePointer<CChar>>(Process.unsafeArgv), nil, NSStringFromClass(AppDelegate.self)
3535
)
3636

Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 46;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
81247EED1D330DBE00717BA3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81247EEC1D330DBE00717BA3 /* AppDelegate.swift */; };
11+
81247EEF1D330DBE00717BA3 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81247EEE1D330DBE00717BA3 /* ViewController.swift */; };
12+
81247EF41D330DBE00717BA3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 81247EF31D330DBE00717BA3 /* Assets.xcassets */; };
13+
81247EF71D330DBE00717BA3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81247EF51D330DBE00717BA3 /* LaunchScreen.storyboard */; };
14+
/* End PBXBuildFile section */
15+
16+
/* Begin PBXFileReference section */
17+
81247EE91D330DBE00717BA3 /* Truly Empty.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Truly Empty.app"; sourceTree = BUILT_PRODUCTS_DIR; };
18+
81247EEC1D330DBE00717BA3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
19+
81247EEE1D330DBE00717BA3 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
20+
81247EF31D330DBE00717BA3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
21+
81247EF61D330DBE00717BA3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
22+
81247EF81D330DBE00717BA3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
23+
/* End PBXFileReference section */
24+
25+
/* Begin PBXFrameworksBuildPhase section */
26+
81247EE61D330DBE00717BA3 /* Frameworks */ = {
27+
isa = PBXFrameworksBuildPhase;
28+
buildActionMask = 2147483647;
29+
files = (
30+
);
31+
runOnlyForDeploymentPostprocessing = 0;
32+
};
33+
/* End PBXFrameworksBuildPhase section */
34+
35+
/* Begin PBXGroup section */
36+
81247EE01D330DBE00717BA3 = {
37+
isa = PBXGroup;
38+
children = (
39+
81247EEB1D330DBE00717BA3 /* Truly Empty */,
40+
81247EEA1D330DBE00717BA3 /* Products */,
41+
);
42+
sourceTree = "<group>";
43+
};
44+
81247EEA1D330DBE00717BA3 /* Products */ = {
45+
isa = PBXGroup;
46+
children = (
47+
81247EE91D330DBE00717BA3 /* Truly Empty.app */,
48+
);
49+
name = Products;
50+
sourceTree = "<group>";
51+
};
52+
81247EEB1D330DBE00717BA3 /* Truly Empty */ = {
53+
isa = PBXGroup;
54+
children = (
55+
81247EEC1D330DBE00717BA3 /* AppDelegate.swift */,
56+
81247EEE1D330DBE00717BA3 /* ViewController.swift */,
57+
81247EF31D330DBE00717BA3 /* Assets.xcassets */,
58+
81247EF51D330DBE00717BA3 /* LaunchScreen.storyboard */,
59+
81247EF81D330DBE00717BA3 /* Info.plist */,
60+
);
61+
path = "Truly Empty";
62+
sourceTree = "<group>";
63+
};
64+
/* End PBXGroup section */
65+
66+
/* Begin PBXNativeTarget section */
67+
81247EE81D330DBE00717BA3 /* Truly Empty */ = {
68+
isa = PBXNativeTarget;
69+
buildConfigurationList = 81247EFB1D330DBE00717BA3 /* Build configuration list for PBXNativeTarget "Truly Empty" */;
70+
buildPhases = (
71+
81247EE51D330DBE00717BA3 /* Sources */,
72+
81247EE61D330DBE00717BA3 /* Frameworks */,
73+
81247EE71D330DBE00717BA3 /* Resources */,
74+
);
75+
buildRules = (
76+
);
77+
dependencies = (
78+
);
79+
name = "Truly Empty";
80+
productName = "Truly Empty";
81+
productReference = 81247EE91D330DBE00717BA3 /* Truly Empty.app */;
82+
productType = "com.apple.product-type.application";
83+
};
84+
/* End PBXNativeTarget section */
85+
86+
/* Begin PBXProject section */
87+
81247EE11D330DBE00717BA3 /* Project object */ = {
88+
isa = PBXProject;
89+
attributes = {
90+
LastSwiftUpdateCheck = 0800;
91+
LastUpgradeCheck = 0800;
92+
ORGANIZATIONNAME = "Mattt Neuburg";
93+
TargetAttributes = {
94+
81247EE81D330DBE00717BA3 = {
95+
CreatedOnToolsVersion = 8.0;
96+
DevelopmentTeam = W3LHX5RGV2;
97+
DevelopmentTeamName = "Matt Neuburg";
98+
ProvisioningStyle = Automatic;
99+
};
100+
};
101+
};
102+
buildConfigurationList = 81247EE41D330DBE00717BA3 /* Build configuration list for PBXProject "Truly Empty" */;
103+
compatibilityVersion = "Xcode 3.2";
104+
developmentRegion = English;
105+
hasScannedForEncodings = 0;
106+
knownRegions = (
107+
en,
108+
Base,
109+
);
110+
mainGroup = 81247EE01D330DBE00717BA3;
111+
productRefGroup = 81247EEA1D330DBE00717BA3 /* Products */;
112+
projectDirPath = "";
113+
projectRoot = "";
114+
targets = (
115+
81247EE81D330DBE00717BA3 /* Truly Empty */,
116+
);
117+
};
118+
/* End PBXProject section */
119+
120+
/* Begin PBXResourcesBuildPhase section */
121+
81247EE71D330DBE00717BA3 /* Resources */ = {
122+
isa = PBXResourcesBuildPhase;
123+
buildActionMask = 2147483647;
124+
files = (
125+
81247EF71D330DBE00717BA3 /* LaunchScreen.storyboard in Resources */,
126+
81247EF41D330DBE00717BA3 /* Assets.xcassets in Resources */,
127+
);
128+
runOnlyForDeploymentPostprocessing = 0;
129+
};
130+
/* End PBXResourcesBuildPhase section */
131+
132+
/* Begin PBXSourcesBuildPhase section */
133+
81247EE51D330DBE00717BA3 /* Sources */ = {
134+
isa = PBXSourcesBuildPhase;
135+
buildActionMask = 2147483647;
136+
files = (
137+
81247EEF1D330DBE00717BA3 /* ViewController.swift in Sources */,
138+
81247EED1D330DBE00717BA3 /* AppDelegate.swift in Sources */,
139+
);
140+
runOnlyForDeploymentPostprocessing = 0;
141+
};
142+
/* End PBXSourcesBuildPhase section */
143+
144+
/* Begin PBXVariantGroup section */
145+
81247EF51D330DBE00717BA3 /* LaunchScreen.storyboard */ = {
146+
isa = PBXVariantGroup;
147+
children = (
148+
81247EF61D330DBE00717BA3 /* Base */,
149+
);
150+
name = LaunchScreen.storyboard;
151+
sourceTree = "<group>";
152+
};
153+
/* End PBXVariantGroup section */
154+
155+
/* Begin XCBuildConfiguration section */
156+
81247EF91D330DBE00717BA3 /* Debug */ = {
157+
isa = XCBuildConfiguration;
158+
buildSettings = {
159+
ALWAYS_SEARCH_USER_PATHS = NO;
160+
CLANG_ANALYZER_NONNULL = YES;
161+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
162+
CLANG_CXX_LIBRARY = "libc++";
163+
CLANG_ENABLE_MODULES = YES;
164+
CLANG_ENABLE_OBJC_ARC = YES;
165+
CLANG_WARN_BOOL_CONVERSION = YES;
166+
CLANG_WARN_CONSTANT_CONVERSION = YES;
167+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
168+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
169+
CLANG_WARN_EMPTY_BODY = YES;
170+
CLANG_WARN_ENUM_CONVERSION = YES;
171+
CLANG_WARN_INT_CONVERSION = YES;
172+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
173+
CLANG_WARN_UNREACHABLE_CODE = YES;
174+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
175+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
176+
COPY_PHASE_STRIP = NO;
177+
DEBUG_INFORMATION_FORMAT = dwarf;
178+
ENABLE_STRICT_OBJC_MSGSEND = YES;
179+
ENABLE_TESTABILITY = YES;
180+
GCC_C_LANGUAGE_STANDARD = gnu99;
181+
GCC_DYNAMIC_NO_PIC = NO;
182+
GCC_NO_COMMON_BLOCKS = YES;
183+
GCC_OPTIMIZATION_LEVEL = 0;
184+
GCC_PREPROCESSOR_DEFINITIONS = (
185+
"DEBUG=1",
186+
"$(inherited)",
187+
);
188+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
189+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
190+
GCC_WARN_UNDECLARED_SELECTOR = YES;
191+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
192+
GCC_WARN_UNUSED_FUNCTION = YES;
193+
GCC_WARN_UNUSED_VARIABLE = YES;
194+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
195+
MTL_ENABLE_DEBUG_INFO = YES;
196+
ONLY_ACTIVE_ARCH = YES;
197+
SDKROOT = iphoneos;
198+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
199+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
200+
};
201+
name = Debug;
202+
};
203+
81247EFA1D330DBE00717BA3 /* Release */ = {
204+
isa = XCBuildConfiguration;
205+
buildSettings = {
206+
ALWAYS_SEARCH_USER_PATHS = NO;
207+
CLANG_ANALYZER_NONNULL = YES;
208+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
209+
CLANG_CXX_LIBRARY = "libc++";
210+
CLANG_ENABLE_MODULES = YES;
211+
CLANG_ENABLE_OBJC_ARC = YES;
212+
CLANG_WARN_BOOL_CONVERSION = YES;
213+
CLANG_WARN_CONSTANT_CONVERSION = YES;
214+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
215+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
216+
CLANG_WARN_EMPTY_BODY = YES;
217+
CLANG_WARN_ENUM_CONVERSION = YES;
218+
CLANG_WARN_INT_CONVERSION = YES;
219+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
220+
CLANG_WARN_UNREACHABLE_CODE = YES;
221+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
222+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
223+
COPY_PHASE_STRIP = NO;
224+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
225+
ENABLE_NS_ASSERTIONS = NO;
226+
ENABLE_STRICT_OBJC_MSGSEND = YES;
227+
GCC_C_LANGUAGE_STANDARD = gnu99;
228+
GCC_NO_COMMON_BLOCKS = YES;
229+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
230+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
231+
GCC_WARN_UNDECLARED_SELECTOR = YES;
232+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
233+
GCC_WARN_UNUSED_FUNCTION = YES;
234+
GCC_WARN_UNUSED_VARIABLE = YES;
235+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
236+
MTL_ENABLE_DEBUG_INFO = NO;
237+
SDKROOT = iphoneos;
238+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
239+
VALIDATE_PRODUCT = YES;
240+
};
241+
name = Release;
242+
};
243+
81247EFC1D330DBE00717BA3 /* Debug */ = {
244+
isa = XCBuildConfiguration;
245+
buildSettings = {
246+
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
247+
INFOPLIST_FILE = "Truly Empty/Info.plist";
248+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
249+
PRODUCT_BUNDLE_IDENTIFIER = "com.neuburg.matt.Truly-Empty";
250+
PRODUCT_NAME = "$(TARGET_NAME)";
251+
SWIFT_VERSION = 3.0;
252+
};
253+
name = Debug;
254+
};
255+
81247EFD1D330DBE00717BA3 /* Release */ = {
256+
isa = XCBuildConfiguration;
257+
buildSettings = {
258+
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
259+
INFOPLIST_FILE = "Truly Empty/Info.plist";
260+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
261+
PRODUCT_BUNDLE_IDENTIFIER = "com.neuburg.matt.Truly-Empty";
262+
PRODUCT_NAME = "$(TARGET_NAME)";
263+
SWIFT_VERSION = 3.0;
264+
};
265+
name = Release;
266+
};
267+
/* End XCBuildConfiguration section */
268+
269+
/* Begin XCConfigurationList section */
270+
81247EE41D330DBE00717BA3 /* Build configuration list for PBXProject "Truly Empty" */ = {
271+
isa = XCConfigurationList;
272+
buildConfigurations = (
273+
81247EF91D330DBE00717BA3 /* Debug */,
274+
81247EFA1D330DBE00717BA3 /* Release */,
275+
);
276+
defaultConfigurationIsVisible = 0;
277+
defaultConfigurationName = Release;
278+
};
279+
81247EFB1D330DBE00717BA3 /* Build configuration list for PBXNativeTarget "Truly Empty" */ = {
280+
isa = XCConfigurationList;
281+
buildConfigurations = (
282+
81247EFC1D330DBE00717BA3 /* Debug */,
283+
81247EFD1D330DBE00717BA3 /* Release */,
284+
);
285+
defaultConfigurationIsVisible = 0;
286+
};
287+
/* End XCConfigurationList section */
288+
};
289+
rootObject = 81247EE11D330DBE00717BA3 /* Project object */;
290+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
import UIKit
3+
4+
@UIApplicationMain
5+
class AppDelegate : UIResponder, UIApplicationDelegate {
6+
var window : UIWindow?
7+
func application(_ application: UIApplication,
8+
didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?)
9+
-> Bool {
10+
self.window = UIWindow()
11+
self.window!.backgroundColor = UIColor.white()
12+
self.window!.rootViewController = ViewController()
13+
self.window!.makeKeyAndVisible()
14+
return true
15+
}
16+
}

0 commit comments

Comments
 (0)