Skip to content

Commit ee6f57e

Browse files
committed
Sample of a simple Class
Sample of a simple Class to practice the programming fundamentals in Swift
1 parent e0e15c3 commit ee6f57e

File tree

9 files changed

+541
-0
lines changed

9 files changed

+541
-0
lines changed
Lines changed: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 50;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
EBC8466426B8B29A00810A14 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBC8466326B8B29A00810A14 /* main.swift */; };
11+
EBC8466B26B8B32400810A14 /* Production.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBC8466A26B8B32400810A14 /* Production.swift */; };
12+
EBC8466D26B8B35000810A14 /* Movie.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBC8466C26B8B35000810A14 /* Movie.swift */; };
13+
EBC8466F26B8B37500810A14 /* Series.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBC8466E26B8B37500810A14 /* Series.swift */; };
14+
/* End PBXBuildFile section */
15+
16+
/* Begin PBXCopyFilesBuildPhase section */
17+
EBC8465E26B8B29A00810A14 /* CopyFiles */ = {
18+
isa = PBXCopyFilesBuildPhase;
19+
buildActionMask = 2147483647;
20+
dstPath = /usr/share/man/man1/;
21+
dstSubfolderSpec = 0;
22+
files = (
23+
);
24+
runOnlyForDeploymentPostprocessing = 1;
25+
};
26+
/* End PBXCopyFilesBuildPhase section */
27+
28+
/* Begin PBXFileReference section */
29+
EBC8466026B8B29A00810A14 /* Swift-Simple-Class-Example */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Swift-Simple-Class-Example"; sourceTree = BUILT_PRODUCTS_DIR; };
30+
EBC8466326B8B29A00810A14 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
31+
EBC8466A26B8B32400810A14 /* Production.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Production.swift; sourceTree = "<group>"; };
32+
EBC8466C26B8B35000810A14 /* Movie.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Movie.swift; sourceTree = "<group>"; };
33+
EBC8466E26B8B37500810A14 /* Series.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Series.swift; sourceTree = "<group>"; };
34+
/* End PBXFileReference section */
35+
36+
/* Begin PBXFrameworksBuildPhase section */
37+
EBC8465D26B8B29A00810A14 /* Frameworks */ = {
38+
isa = PBXFrameworksBuildPhase;
39+
buildActionMask = 2147483647;
40+
files = (
41+
);
42+
runOnlyForDeploymentPostprocessing = 0;
43+
};
44+
/* End PBXFrameworksBuildPhase section */
45+
46+
/* Begin PBXGroup section */
47+
EBC8465726B8B29A00810A14 = {
48+
isa = PBXGroup;
49+
children = (
50+
EBC8466226B8B29A00810A14 /* Swift-Simple-Class-Example */,
51+
EBC8466126B8B29A00810A14 /* Products */,
52+
);
53+
sourceTree = "<group>";
54+
};
55+
EBC8466126B8B29A00810A14 /* Products */ = {
56+
isa = PBXGroup;
57+
children = (
58+
EBC8466026B8B29A00810A14 /* Swift-Simple-Class-Example */,
59+
);
60+
name = Products;
61+
sourceTree = "<group>";
62+
};
63+
EBC8466226B8B29A00810A14 /* Swift-Simple-Class-Example */ = {
64+
isa = PBXGroup;
65+
children = (
66+
EBC8466326B8B29A00810A14 /* main.swift */,
67+
EBC8466A26B8B32400810A14 /* Production.swift */,
68+
EBC8466C26B8B35000810A14 /* Movie.swift */,
69+
EBC8466E26B8B37500810A14 /* Series.swift */,
70+
);
71+
path = "Swift-Simple-Class-Example";
72+
sourceTree = "<group>";
73+
};
74+
/* End PBXGroup section */
75+
76+
/* Begin PBXNativeTarget section */
77+
EBC8465F26B8B29A00810A14 /* Swift-Simple-Class-Example */ = {
78+
isa = PBXNativeTarget;
79+
buildConfigurationList = EBC8466726B8B29A00810A14 /* Build configuration list for PBXNativeTarget "Swift-Simple-Class-Example" */;
80+
buildPhases = (
81+
EBC8465C26B8B29A00810A14 /* Sources */,
82+
EBC8465D26B8B29A00810A14 /* Frameworks */,
83+
EBC8465E26B8B29A00810A14 /* CopyFiles */,
84+
);
85+
buildRules = (
86+
);
87+
dependencies = (
88+
);
89+
name = "Swift-Simple-Class-Example";
90+
productName = "Swift-Simple-Class-Example";
91+
productReference = EBC8466026B8B29A00810A14 /* Swift-Simple-Class-Example */;
92+
productType = "com.apple.product-type.tool";
93+
};
94+
/* End PBXNativeTarget section */
95+
96+
/* Begin PBXProject section */
97+
EBC8465826B8B29A00810A14 /* Project object */ = {
98+
isa = PBXProject;
99+
attributes = {
100+
LastSwiftUpdateCheck = 1250;
101+
LastUpgradeCheck = 1250;
102+
TargetAttributes = {
103+
EBC8465F26B8B29A00810A14 = {
104+
CreatedOnToolsVersion = 12.5.1;
105+
};
106+
};
107+
};
108+
buildConfigurationList = EBC8465B26B8B29A00810A14 /* Build configuration list for PBXProject "Swift-Simple-Class-Example" */;
109+
compatibilityVersion = "Xcode 9.3";
110+
developmentRegion = en;
111+
hasScannedForEncodings = 0;
112+
knownRegions = (
113+
en,
114+
Base,
115+
);
116+
mainGroup = EBC8465726B8B29A00810A14;
117+
productRefGroup = EBC8466126B8B29A00810A14 /* Products */;
118+
projectDirPath = "";
119+
projectRoot = "";
120+
targets = (
121+
EBC8465F26B8B29A00810A14 /* Swift-Simple-Class-Example */,
122+
);
123+
};
124+
/* End PBXProject section */
125+
126+
/* Begin PBXSourcesBuildPhase section */
127+
EBC8465C26B8B29A00810A14 /* Sources */ = {
128+
isa = PBXSourcesBuildPhase;
129+
buildActionMask = 2147483647;
130+
files = (
131+
EBC8466B26B8B32400810A14 /* Production.swift in Sources */,
132+
EBC8466426B8B29A00810A14 /* main.swift in Sources */,
133+
EBC8466F26B8B37500810A14 /* Series.swift in Sources */,
134+
EBC8466D26B8B35000810A14 /* Movie.swift in Sources */,
135+
);
136+
runOnlyForDeploymentPostprocessing = 0;
137+
};
138+
/* End PBXSourcesBuildPhase section */
139+
140+
/* Begin XCBuildConfiguration section */
141+
EBC8466526B8B29A00810A14 /* Debug */ = {
142+
isa = XCBuildConfiguration;
143+
buildSettings = {
144+
ALWAYS_SEARCH_USER_PATHS = NO;
145+
CLANG_ANALYZER_NONNULL = YES;
146+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
147+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
148+
CLANG_CXX_LIBRARY = "libc++";
149+
CLANG_ENABLE_MODULES = YES;
150+
CLANG_ENABLE_OBJC_ARC = YES;
151+
CLANG_ENABLE_OBJC_WEAK = YES;
152+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
153+
CLANG_WARN_BOOL_CONVERSION = YES;
154+
CLANG_WARN_COMMA = YES;
155+
CLANG_WARN_CONSTANT_CONVERSION = YES;
156+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
157+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
158+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
159+
CLANG_WARN_EMPTY_BODY = YES;
160+
CLANG_WARN_ENUM_CONVERSION = YES;
161+
CLANG_WARN_INFINITE_RECURSION = YES;
162+
CLANG_WARN_INT_CONVERSION = YES;
163+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
164+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
165+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
166+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
167+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
168+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
169+
CLANG_WARN_STRICT_PROTOTYPES = YES;
170+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
171+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
172+
CLANG_WARN_UNREACHABLE_CODE = YES;
173+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
174+
COPY_PHASE_STRIP = NO;
175+
DEBUG_INFORMATION_FORMAT = dwarf;
176+
ENABLE_STRICT_OBJC_MSGSEND = YES;
177+
ENABLE_TESTABILITY = YES;
178+
GCC_C_LANGUAGE_STANDARD = gnu11;
179+
GCC_DYNAMIC_NO_PIC = NO;
180+
GCC_NO_COMMON_BLOCKS = YES;
181+
GCC_OPTIMIZATION_LEVEL = 0;
182+
GCC_PREPROCESSOR_DEFINITIONS = (
183+
"DEBUG=1",
184+
"$(inherited)",
185+
);
186+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
187+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
188+
GCC_WARN_UNDECLARED_SELECTOR = YES;
189+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
190+
GCC_WARN_UNUSED_FUNCTION = YES;
191+
GCC_WARN_UNUSED_VARIABLE = YES;
192+
MACOSX_DEPLOYMENT_TARGET = 11.3;
193+
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
194+
MTL_FAST_MATH = YES;
195+
ONLY_ACTIVE_ARCH = YES;
196+
SDKROOT = macosx;
197+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
198+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
199+
};
200+
name = Debug;
201+
};
202+
EBC8466626B8B29A00810A14 /* Release */ = {
203+
isa = XCBuildConfiguration;
204+
buildSettings = {
205+
ALWAYS_SEARCH_USER_PATHS = NO;
206+
CLANG_ANALYZER_NONNULL = YES;
207+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
208+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
209+
CLANG_CXX_LIBRARY = "libc++";
210+
CLANG_ENABLE_MODULES = YES;
211+
CLANG_ENABLE_OBJC_ARC = YES;
212+
CLANG_ENABLE_OBJC_WEAK = YES;
213+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
214+
CLANG_WARN_BOOL_CONVERSION = YES;
215+
CLANG_WARN_COMMA = YES;
216+
CLANG_WARN_CONSTANT_CONVERSION = YES;
217+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
218+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
219+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
220+
CLANG_WARN_EMPTY_BODY = YES;
221+
CLANG_WARN_ENUM_CONVERSION = YES;
222+
CLANG_WARN_INFINITE_RECURSION = YES;
223+
CLANG_WARN_INT_CONVERSION = YES;
224+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
225+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
226+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
227+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
228+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
229+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
230+
CLANG_WARN_STRICT_PROTOTYPES = YES;
231+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
232+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
233+
CLANG_WARN_UNREACHABLE_CODE = YES;
234+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
235+
COPY_PHASE_STRIP = NO;
236+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
237+
ENABLE_NS_ASSERTIONS = NO;
238+
ENABLE_STRICT_OBJC_MSGSEND = YES;
239+
GCC_C_LANGUAGE_STANDARD = gnu11;
240+
GCC_NO_COMMON_BLOCKS = YES;
241+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
242+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
243+
GCC_WARN_UNDECLARED_SELECTOR = YES;
244+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
245+
GCC_WARN_UNUSED_FUNCTION = YES;
246+
GCC_WARN_UNUSED_VARIABLE = YES;
247+
MACOSX_DEPLOYMENT_TARGET = 11.3;
248+
MTL_ENABLE_DEBUG_INFO = NO;
249+
MTL_FAST_MATH = YES;
250+
SDKROOT = macosx;
251+
SWIFT_COMPILATION_MODE = wholemodule;
252+
SWIFT_OPTIMIZATION_LEVEL = "-O";
253+
};
254+
name = Release;
255+
};
256+
EBC8466826B8B29A00810A14 /* Debug */ = {
257+
isa = XCBuildConfiguration;
258+
buildSettings = {
259+
CODE_SIGN_STYLE = Automatic;
260+
DEVELOPMENT_TEAM = D3DQBSL33L;
261+
ENABLE_HARDENED_RUNTIME = YES;
262+
PRODUCT_NAME = "$(TARGET_NAME)";
263+
SWIFT_VERSION = 5.0;
264+
};
265+
name = Debug;
266+
};
267+
EBC8466926B8B29A00810A14 /* Release */ = {
268+
isa = XCBuildConfiguration;
269+
buildSettings = {
270+
CODE_SIGN_STYLE = Automatic;
271+
DEVELOPMENT_TEAM = D3DQBSL33L;
272+
ENABLE_HARDENED_RUNTIME = YES;
273+
PRODUCT_NAME = "$(TARGET_NAME)";
274+
SWIFT_VERSION = 5.0;
275+
};
276+
name = Release;
277+
};
278+
/* End XCBuildConfiguration section */
279+
280+
/* Begin XCConfigurationList section */
281+
EBC8465B26B8B29A00810A14 /* Build configuration list for PBXProject "Swift-Simple-Class-Example" */ = {
282+
isa = XCConfigurationList;
283+
buildConfigurations = (
284+
EBC8466526B8B29A00810A14 /* Debug */,
285+
EBC8466626B8B29A00810A14 /* Release */,
286+
);
287+
defaultConfigurationIsVisible = 0;
288+
defaultConfigurationName = Release;
289+
};
290+
EBC8466726B8B29A00810A14 /* Build configuration list for PBXNativeTarget "Swift-Simple-Class-Example" */ = {
291+
isa = XCConfigurationList;
292+
buildConfigurations = (
293+
EBC8466826B8B29A00810A14 /* Debug */,
294+
EBC8466926B8B29A00810A14 /* Release */,
295+
);
296+
defaultConfigurationIsVisible = 0;
297+
defaultConfigurationName = Release;
298+
};
299+
/* End XCConfigurationList section */
300+
};
301+
rootObject = EBC8465826B8B29A00810A14 /* Project object */;
302+
}

Swift-Simple-Class-Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SchemeUserState</key>
6+
<dict>
7+
<key>Swift-Simple-Class-Example.xcscheme_^#shared#^_</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
</dict>
14+
</plist>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//
2+
// Movie.swift
3+
// Swift-Simple-Class-Example
4+
//
5+
// Created by Omairys Uzcátegui on 2021-06-10.
6+
//
7+
8+
import Foundation
9+
class Movie : Producction{
10+
var cinema: [String] = []
11+
var income: [Double] = []
12+
13+
init(no: Int, title: String, year: Int, cinema: [String], income: [Double]) {
14+
self.cinema = cinema
15+
self.income = income
16+
super.init(no: no, title: title, year: year)
17+
}
18+
19+
override func findIncome() -> Double {
20+
var total = 0.0
21+
for i in self.income {
22+
total = total + i
23+
}
24+
return (total*1000000)*0.60
25+
}
26+
27+
override func printDetails() {
28+
super.printDetails()
29+
print("Cinema:\(self.cinema) Income:\(self.income)")
30+
}
31+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// Production.swift
3+
// Swift-Simple-Class-Example
4+
//
5+
// Created by Omairys Uzcátegui on 2021-06-10.
6+
//
7+
8+
import Foundation
9+
10+
class Producction{
11+
var no: Int
12+
var title: String
13+
var year: Int
14+
15+
init(no: Int, title: String, year:Int) {
16+
self.no = no
17+
self.title = title
18+
self.year = year
19+
}
20+
func findIncome() -> Double {
21+
return 0.0
22+
}
23+
24+
func printDetails() {
25+
print("Number:\(self.no) Title:\(self.title) Year:\(self.year)")
26+
}
27+
}

0 commit comments

Comments
 (0)