diff --git a/Sprint 6/Module 2-Custom Controls/UIControl/UIControl.xcodeproj/project.pbxproj b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl.xcodeproj/project.pbxproj new file mode 100644 index 00000000..9ef85702 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl.xcodeproj/project.pbxproj @@ -0,0 +1,343 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 486C00002200EC0300A32DEB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 486CFFFF2200EC0300A32DEB /* AppDelegate.swift */; }; + 486C00022200EC0300A32DEB /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 486C00012200EC0300A32DEB /* ViewController.swift */; }; + 486C00052200EC0300A32DEB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 486C00032200EC0300A32DEB /* Main.storyboard */; }; + 486C00072200EC0400A32DEB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 486C00062200EC0400A32DEB /* Assets.xcassets */; }; + 486C000A2200EC0400A32DEB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 486C00082200EC0400A32DEB /* LaunchScreen.storyboard */; }; + 486C00122200ECFD00A32DEB /* CustomControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 486C00112200ECFD00A32DEB /* CustomControl.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 486C00012200EC0300A32DEB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 486C00042200EC0300A32DEB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 486C00062200EC0400A32DEB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 486C00092200EC0400A32DEB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 486C000B2200EC0400A32DEB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 486C00112200ECFD00A32DEB /* CustomControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomControl.swift; sourceTree = ""; }; + 486CFFFC2200EC0300A32DEB /* UIControl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UIControl.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 486CFFFF2200EC0300A32DEB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 486CFFF92200EC0300A32DEB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 486CFFF32200EC0200A32DEB = { + isa = PBXGroup; + children = ( + 486CFFFE2200EC0300A32DEB /* UIControl */, + 486CFFFD2200EC0300A32DEB /* Products */, + ); + sourceTree = ""; + }; + 486CFFFD2200EC0300A32DEB /* Products */ = { + isa = PBXGroup; + children = ( + 486CFFFC2200EC0300A32DEB /* UIControl.app */, + ); + name = Products; + sourceTree = ""; + }; + 486CFFFE2200EC0300A32DEB /* UIControl */ = { + isa = PBXGroup; + children = ( + 486CFFFF2200EC0300A32DEB /* AppDelegate.swift */, + 486C00012200EC0300A32DEB /* ViewController.swift */, + 486C00112200ECFD00A32DEB /* CustomControl.swift */, + 486C00032200EC0300A32DEB /* Main.storyboard */, + 486C00062200EC0400A32DEB /* Assets.xcassets */, + 486C00082200EC0400A32DEB /* LaunchScreen.storyboard */, + 486C000B2200EC0400A32DEB /* Info.plist */, + ); + path = UIControl; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 486CFFFB2200EC0300A32DEB /* UIControl */ = { + isa = PBXNativeTarget; + buildConfigurationList = 486C000E2200EC0400A32DEB /* Build configuration list for PBXNativeTarget "UIControl" */; + buildPhases = ( + 486CFFF82200EC0300A32DEB /* Sources */, + 486CFFF92200EC0300A32DEB /* Frameworks */, + 486CFFFA2200EC0300A32DEB /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = UIControl; + productName = UIControl; + productReference = 486CFFFC2200EC0300A32DEB /* UIControl.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 486CFFF42200EC0300A32DEB /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1010; + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = Frulwinn; + TargetAttributes = { + 486CFFFB2200EC0300A32DEB = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = 486CFFF72200EC0300A32DEB /* Build configuration list for PBXProject "UIControl" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 486CFFF32200EC0200A32DEB; + productRefGroup = 486CFFFD2200EC0300A32DEB /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 486CFFFB2200EC0300A32DEB /* UIControl */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 486CFFFA2200EC0300A32DEB /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 486C000A2200EC0400A32DEB /* LaunchScreen.storyboard in Resources */, + 486C00072200EC0400A32DEB /* Assets.xcassets in Resources */, + 486C00052200EC0300A32DEB /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 486CFFF82200EC0300A32DEB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 486C00022200EC0300A32DEB /* ViewController.swift in Sources */, + 486C00122200ECFD00A32DEB /* CustomControl.swift in Sources */, + 486C00002200EC0300A32DEB /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 486C00032200EC0300A32DEB /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 486C00042200EC0300A32DEB /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 486C00082200EC0400A32DEB /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 486C00092200EC0400A32DEB /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 486C000C2200EC0400A32DEB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 486C000D2200EC0400A32DEB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 486C000F2200EC0400A32DEB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = UIControl/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.Frulwinn.UIControl; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 486C00102200EC0400A32DEB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = UIControl/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.Frulwinn.UIControl; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 486C000E2200EC0400A32DEB /* Build configuration list for PBXNativeTarget "UIControl" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 486C000F2200EC0400A32DEB /* Debug */, + 486C00102200EC0400A32DEB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 486CFFF72200EC0300A32DEB /* Build configuration list for PBXProject "UIControl" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 486C000C2200EC0400A32DEB /* Debug */, + 486C000D2200EC0400A32DEB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 486CFFF42200EC0300A32DEB /* Project object */; +} diff --git a/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/AppDelegate.swift b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/AppDelegate.swift new file mode 100644 index 00000000..9dd7abee --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/AppDelegate.swift @@ -0,0 +1,20 @@ +// +// AppDelegate.swift +// UIControl +// +// Created by Lambda_School_Loaner_34 on 1/29/19. +// Copyright © 2019 Frulwinn. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + return true + } +} + diff --git a/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Assets.xcassets/AppIcon.appiconset/Contents.json b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d8db8d65 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Assets.xcassets/Contents.json b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Assets.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Base.lproj/LaunchScreen.storyboard b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..bfa36129 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Base.lproj/Main.storyboard b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Base.lproj/Main.storyboard new file mode 100644 index 00000000..6fddc91a --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Base.lproj/Main.storyboard @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/CustomControl.swift b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/CustomControl.swift new file mode 100644 index 00000000..3f64df58 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/CustomControl.swift @@ -0,0 +1,116 @@ +// Copyright © 2019 Frulwinn. All rights reserved. + +import UIKit + +class CustomControl: UIControl { + + //MARK: - Properties + var labels: [UILabel] = [] + var value: Int = 1 + + let componentDimension: CGFloat = 40.0 + let componentCount = 5 + let componentActiveColor = UIColor.black + let componentInactiveColor = UIColor.gray + + required init?(coder aCoder: NSCoder) { + super.init(coder: aCoder) + setup() + } + + func setup() { + var count: CGFloat = 0.0 + for number in 1...5 { + //spacing + let space: CGFloat = (componentDimension * count) + (8.0 * count) + //create labels, set label's frame to size + let label = UILabel(frame: CGRect(x: space, y: 0, width: componentDimension, height: componentDimension)) + //add one as subview + self.addSubview(label) + //store label in local array with append + labels.append(label) + //add tag for each view + label.tag = number + count += 1.0 + //set font to bold system font size 32 + label.font = UIFont.boldSystemFont(ofSize: 32.0) + //set text to Unicode star + label.text = "✭" + //alignment center for label + label.textAlignment = .center + //set textColor to active for the first or inactive for the others + label.textColor = componentInactiveColor + } + } + override var intrinsicContentSize: CGSize { + let componentsWidth = CGFloat(componentCount) * componentDimension + let componentsSpacing = CGFloat(componentCount + 1) * 8.0 + let width = componentsWidth + componentsSpacing + return CGSize(width: width, height: componentDimension) + } + + //Mark: - Touch handlers + override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool { + updateValue(at: touch) + return true + } + + override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool { + let touchPoint = touch.location(in: self) + if bounds.contains(touchPoint) { + sendActions(for: [.valueChanged, .touchDragInside]) + updateValue(at: touch) + } else { + sendActions(for: [.touchDragOutside]) + } + return true + } + + override func endTracking(_ touch: UITouch?, with event: UIEvent?) { + defer { super.endTracking(touch, with: event) } + guard let touch = touch else { return } + let touchPoint = touch.location(in: self) + + if bounds.contains(touchPoint) { + sendActions(for: [.touchUpInside, .valueChanged]) + } else { + sendActions(for: [.touchUpOutside]) + } + } + + override func cancelTracking(with event: UIEvent?) { + sendActions(for: [.touchCancel]) + } + + func updateValue(at touch: UITouch) { + //loop through component labels and detects whether touch location is contained in each label's frame + for label in labels { + let touchPoint = touch.location(in: self) + //when touch overlaps label set control's value to that tag + //update label colors to reflect current touch send valueChanged action + if label.frame.contains(touchPoint) { + value = label.tag + sendActions(for: [.valueChanged]) + label.performFlare() + } + } + } +} + +extension UIView { + //var labels = labels + + // "Flare view" animation sequence + func performFlare() { + func flare() { transform = CGAffineTransform(scaleX: 1.6, y: 1.6) } + func unflare() { transform = .identity } + func color() { layer.backgroundColor = UIColor.blue.cgColor } + func unColor() { layer.backgroundColor = UIColor.clear.cgColor } + + UIView.animate(withDuration: 0.5, + animations: { flare(); color() }, + completion: { _ in UIView.animate(withDuration: 0.3) { unflare() }; unColor()}) + + + } +} diff --git a/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Info.plist b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Info.plist new file mode 100644 index 00000000..16be3b68 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/ViewController.swift b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/ViewController.swift new file mode 100644 index 00000000..45ff004c --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/ViewController.swift @@ -0,0 +1,17 @@ +// Copyright © 2019 Frulwinn. All rights reserved. + +import UIKit + +class ViewController: UIViewController { + + @IBAction func updateRating(_ ratingControl: CustomControl) { + let n = ratingControl.value + + if n > 1 { + title = "User Rating: \(n) stars" + } else { + title = "User Rating: \(n) star" + } + } +} + diff --git a/Sprint 6/Module 3 - UIView Animation/ScatterGather.zip b/Sprint 6/Module 3 - UIView Animation/ScatterGather.zip new file mode 100644 index 00000000..deb7d511 Binary files /dev/null and b/Sprint 6/Module 3 - UIView Animation/ScatterGather.zip differ diff --git a/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather.xcodeproj/project.pbxproj b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather.xcodeproj/project.pbxproj new file mode 100644 index 00000000..86f4fde6 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather.xcodeproj/project.pbxproj @@ -0,0 +1,339 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 48246CB322023D7F00DC2AA1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48246CB222023D7F00DC2AA1 /* AppDelegate.swift */; }; + 48246CB522023D7F00DC2AA1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48246CB422023D7F00DC2AA1 /* ViewController.swift */; }; + 48246CB822023D7F00DC2AA1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 48246CB622023D7F00DC2AA1 /* Main.storyboard */; }; + 48246CBA22023D8000DC2AA1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 48246CB922023D8000DC2AA1 /* Assets.xcassets */; }; + 48246CBD22023D8000DC2AA1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 48246CBB22023D8000DC2AA1 /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 48246CAF22023D7F00DC2AA1 /* ScatterGather.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ScatterGather.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 48246CB222023D7F00DC2AA1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 48246CB422023D7F00DC2AA1 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 48246CB722023D7F00DC2AA1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 48246CB922023D8000DC2AA1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 48246CBC22023D8000DC2AA1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 48246CBE22023D8000DC2AA1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 48246CAC22023D7F00DC2AA1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 48246CA622023D7E00DC2AA1 = { + isa = PBXGroup; + children = ( + 48246CB122023D7F00DC2AA1 /* ScatterGather */, + 48246CB022023D7F00DC2AA1 /* Products */, + ); + sourceTree = ""; + }; + 48246CB022023D7F00DC2AA1 /* Products */ = { + isa = PBXGroup; + children = ( + 48246CAF22023D7F00DC2AA1 /* ScatterGather.app */, + ); + name = Products; + sourceTree = ""; + }; + 48246CB122023D7F00DC2AA1 /* ScatterGather */ = { + isa = PBXGroup; + children = ( + 48246CB222023D7F00DC2AA1 /* AppDelegate.swift */, + 48246CB422023D7F00DC2AA1 /* ViewController.swift */, + 48246CB622023D7F00DC2AA1 /* Main.storyboard */, + 48246CB922023D8000DC2AA1 /* Assets.xcassets */, + 48246CBB22023D8000DC2AA1 /* LaunchScreen.storyboard */, + 48246CBE22023D8000DC2AA1 /* Info.plist */, + ); + path = ScatterGather; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 48246CAE22023D7F00DC2AA1 /* ScatterGather */ = { + isa = PBXNativeTarget; + buildConfigurationList = 48246CC122023D8000DC2AA1 /* Build configuration list for PBXNativeTarget "ScatterGather" */; + buildPhases = ( + 48246CAB22023D7F00DC2AA1 /* Sources */, + 48246CAC22023D7F00DC2AA1 /* Frameworks */, + 48246CAD22023D7F00DC2AA1 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ScatterGather; + productName = ScatterGather; + productReference = 48246CAF22023D7F00DC2AA1 /* ScatterGather.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 48246CA722023D7E00DC2AA1 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1010; + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = Frulwinn; + TargetAttributes = { + 48246CAE22023D7F00DC2AA1 = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = 48246CAA22023D7E00DC2AA1 /* Build configuration list for PBXProject "ScatterGather" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 48246CA622023D7E00DC2AA1; + productRefGroup = 48246CB022023D7F00DC2AA1 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 48246CAE22023D7F00DC2AA1 /* ScatterGather */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 48246CAD22023D7F00DC2AA1 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 48246CBD22023D8000DC2AA1 /* LaunchScreen.storyboard in Resources */, + 48246CBA22023D8000DC2AA1 /* Assets.xcassets in Resources */, + 48246CB822023D7F00DC2AA1 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 48246CAB22023D7F00DC2AA1 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 48246CB522023D7F00DC2AA1 /* ViewController.swift in Sources */, + 48246CB322023D7F00DC2AA1 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 48246CB622023D7F00DC2AA1 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 48246CB722023D7F00DC2AA1 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 48246CBB22023D8000DC2AA1 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 48246CBC22023D8000DC2AA1 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 48246CBF22023D8000DC2AA1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 48246CC022023D8000DC2AA1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 48246CC222023D8000DC2AA1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = ScatterGather/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.Frulwinn.ScatterGather; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 48246CC322023D8000DC2AA1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = ScatterGather/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.Frulwinn.ScatterGather; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 48246CAA22023D7E00DC2AA1 /* Build configuration list for PBXProject "ScatterGather" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 48246CBF22023D8000DC2AA1 /* Debug */, + 48246CC022023D8000DC2AA1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 48246CC122023D8000DC2AA1 /* Build configuration list for PBXNativeTarget "ScatterGather" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 48246CC222023D8000DC2AA1 /* Debug */, + 48246CC322023D8000DC2AA1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 48246CA722023D7E00DC2AA1 /* Project object */; +} diff --git a/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/AppDelegate.swift b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/AppDelegate.swift new file mode 100644 index 00000000..36bf601b --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// ScatterGather +// +// Created by Lambda_School_Loaner_34 on 1/30/19. +// Copyright © 2019 Frulwinn. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Assets.xcassets/AppIcon.appiconset/Contents.json b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d8db8d65 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Assets.xcassets/Contents.json b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Assets.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Assets.xcassets/Lambda_Logo_Full.imageset/Contents.json b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Assets.xcassets/Lambda_Logo_Full.imageset/Contents.json new file mode 100644 index 00000000..a6255de6 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Assets.xcassets/Lambda_Logo_Full.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "Lambda_Logo_Full.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Assets.xcassets/Lambda_Logo_Full.imageset/Lambda_Logo_Full.pdf b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Assets.xcassets/Lambda_Logo_Full.imageset/Lambda_Logo_Full.pdf new file mode 100644 index 00000000..3a8651d4 Binary files /dev/null and b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Assets.xcassets/Lambda_Logo_Full.imageset/Lambda_Logo_Full.pdf differ diff --git a/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Base.lproj/LaunchScreen.storyboard b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..bfa36129 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Base.lproj/Main.storyboard b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Base.lproj/Main.storyboard new file mode 100644 index 00000000..3542fd67 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Base.lproj/Main.storyboard @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Info.plist b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Info.plist new file mode 100644 index 00000000..16be3b68 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/ViewController.swift b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/ViewController.swift new file mode 100644 index 00000000..82c2685a --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/ScatterGather/ScatterGather/ViewController.swift @@ -0,0 +1,159 @@ +// Copyright © 2019 Frulwinn. All rights reserved. + +import UIKit + +class ViewController: UIViewController { + + //MARK: - Properties + var shouldScramble: Bool = false + var labels: [UILabel] = [] + let logoView = UIImageView() + + func scramble() { + shouldScramble = !shouldScramble + } + + @IBAction func toggle(_ sender: Any) { + scramble() + + if shouldScramble == true { + for label in labels { + scatter(label) + } +// UIImageView.animate(withDuration: 2) { +// self.logoView.alpha = 1.0 +// } + } else { + for label in labels { + gather(label) + } +// UIImageView.animate(withDuration: 2) { +// self.logoView.alpha = 0 +// } + } + } + + func scatter(_ label: UILabel) { + UIImageView.animate(withDuration: 2) { + self.logoView.alpha = 1.0 + } + for label in labels { + UIView.animate(withDuration: 3) { + label.transform = CGAffineTransform(rotationAngle: CGFloat(self.randomInt(min: 1, max: 200))) + label.transform = CGAffineTransform(scaleX: CGFloat(self.randomInt(min: 1, max: 4)), y: CGFloat(self.randomInt(min: 1, max: 4))).translatedBy(x: CGFloat(self.randomInt(min: 1, max: 4)), y: CGFloat(self.randomInt(min: 10, max: 40))) + label.backgroundColor = self.getRandomColor() + label.textColor = self.getRandomColor() + } + } + } + + func gather(_ label: UILabel) { + UIImageView.animate(withDuration: 2) { + self.logoView.alpha = 0 + } + for label in labels { + UIView.animate(withDuration: 1.5) { + label.transform = .identity + } + } + } + + override func viewDidLoad() { + super.viewDidLoad() + + //adding all my labels programatically + let lLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 75, height: 75)) + lLabel.translatesAutoresizingMaskIntoConstraints = false + view.addSubview(lLabel) + lLabel.textAlignment = .center + lLabel.text = "L" + self.view.addSubview(lLabel) + labels.append(lLabel) + + let aLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 75, height: 75)) + aLabel.translatesAutoresizingMaskIntoConstraints = false + view.addSubview(aLabel) + aLabel.textAlignment = .center + aLabel.text = "A" + self.view.addSubview(aLabel) + labels.append(aLabel) + + let mLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 75, height: 75)) + mLabel.translatesAutoresizingMaskIntoConstraints = false + view.addSubview(mLabel) + mLabel.textAlignment = .center + mLabel.text = "M" + self.view.addSubview(mLabel) + labels.append(mLabel) + + let bLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 75, height: 75)) + bLabel.translatesAutoresizingMaskIntoConstraints = false + view.addSubview(bLabel) + bLabel.textAlignment = .center + bLabel.text = "B" + self.view.addSubview(bLabel) + labels.append(bLabel) + + let dLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 75, height: 75)) + dLabel.translatesAutoresizingMaskIntoConstraints = false + view.addSubview(dLabel) + dLabel.textAlignment = .center + dLabel.text = "D" + self.view.addSubview(dLabel) + labels.append(dLabel) + + let lastALabel = UILabel(frame: CGRect(x: 0, y: 0, width: 75, height: 75)) + lastALabel.translatesAutoresizingMaskIntoConstraints = false + view.addSubview(lastALabel) + lastALabel.textAlignment = .center + lastALabel.text = "A" + self.view.addSubview(lastALabel) + labels.append(lastALabel) + + let stackView = UIStackView() + stackView.translatesAutoresizingMaskIntoConstraints = false + view.addSubview(stackView) + + stackView.axis = .horizontal + //stackView.spacing = 10 + stackView.distribution = .fillEqually + + stackView.addArrangedSubview(lLabel) + stackView.addArrangedSubview(aLabel) + stackView.addArrangedSubview(mLabel) + stackView.addArrangedSubview(bLabel) + stackView.addArrangedSubview(dLabel) + stackView.addArrangedSubview(lastALabel) + + let logoView = UIImageView() + logoView.image = UIImage(named: "Lambda_Logo_Full") + logoView.contentMode = .scaleAspectFit + //logoView.frame = CGRect(x: 0, y: 0, width: 200, height: 100) + logoView.translatesAutoresizingMaskIntoConstraints = false + view.addSubview(logoView) + + NSLayoutConstraint.activate([ + stackView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 40), + stackView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -40), + stackView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 20), + logoView.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor), + logoView.centerYAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerYAnchor), + logoView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 70), + logoView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -70), + ]) + } + + //random position + func randomInt(min: Int, max: Int) -> Int { + return min + Int(arc4random_uniform(UInt32(max - min + 1))) + } + + //get random colors + func getRandomColor() -> UIColor { + let red:CGFloat = CGFloat(drand48()) + let green:CGFloat = CGFloat(drand48()) + let blue:CGFloat = CGFloat(drand48()) + return UIColor(red: red, green: green, blue: blue, alpha: 0.5) + } +} + diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends.xcodeproj/project.pbxproj b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends.xcodeproj/project.pbxproj new file mode 100644 index 00000000..823a67ae --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends.xcodeproj/project.pbxproj @@ -0,0 +1,367 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 481FAC292203A28A004C7337 /* Friend.swift in Sources */ = {isa = PBXBuildFile; fileRef = 481FAC282203A28A004C7337 /* Friend.swift */; }; + 481FAC2C2203AFC7004C7337 /* NavigationControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 481FAC2B2203AFC7004C7337 /* NavigationControllerDelegate.swift */; }; + 481FAC2E2203B1F7004C7337 /* Animator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 481FAC2D2203B1F7004C7337 /* Animator.swift */; }; + 48246D1722038C8900DC2AA1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48246D1622038C8900DC2AA1 /* AppDelegate.swift */; }; + 48246D1922038C8900DC2AA1 /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48246D1822038C8900DC2AA1 /* DetailViewController.swift */; }; + 48246D1C22038C8900DC2AA1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 48246D1A22038C8900DC2AA1 /* Main.storyboard */; }; + 48246D1E22038C8B00DC2AA1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 48246D1D22038C8B00DC2AA1 /* Assets.xcassets */; }; + 48246D2122038C8B00DC2AA1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 48246D1F22038C8B00DC2AA1 /* LaunchScreen.storyboard */; }; + 48246D292203A0D000DC2AA1 /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48246D282203A0D000DC2AA1 /* TableViewController.swift */; }; + 48246D2B2203A14500DC2AA1 /* TableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48246D2A2203A14500DC2AA1 /* TableViewCell.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 481FAC282203A28A004C7337 /* Friend.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Friend.swift; sourceTree = ""; }; + 481FAC2B2203AFC7004C7337 /* NavigationControllerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationControllerDelegate.swift; sourceTree = ""; }; + 481FAC2D2203B1F7004C7337 /* Animator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Animator.swift; sourceTree = ""; }; + 48246D1322038C8900DC2AA1 /* Friends.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Friends.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 48246D1622038C8900DC2AA1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 48246D1822038C8900DC2AA1 /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = ""; }; + 48246D1B22038C8900DC2AA1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 48246D1D22038C8B00DC2AA1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 48246D2022038C8B00DC2AA1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 48246D2222038C8B00DC2AA1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 48246D282203A0D000DC2AA1 /* TableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = ""; }; + 48246D2A2203A14500DC2AA1 /* TableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewCell.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 48246D1022038C8900DC2AA1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 481FAC2A2203AFA5004C7337 /* Controllers */ = { + isa = PBXGroup; + children = ( + 48246D282203A0D000DC2AA1 /* TableViewController.swift */, + 48246D1822038C8900DC2AA1 /* DetailViewController.swift */, + ); + path = Controllers; + sourceTree = ""; + }; + 48246D0A22038C8900DC2AA1 = { + isa = PBXGroup; + children = ( + 48246D1522038C8900DC2AA1 /* Friends */, + 48246D1422038C8900DC2AA1 /* Products */, + ); + sourceTree = ""; + }; + 48246D1422038C8900DC2AA1 /* Products */ = { + isa = PBXGroup; + children = ( + 48246D1322038C8900DC2AA1 /* Friends.app */, + ); + name = Products; + sourceTree = ""; + }; + 48246D1522038C8900DC2AA1 /* Friends */ = { + isa = PBXGroup; + children = ( + 48246D1622038C8900DC2AA1 /* AppDelegate.swift */, + 481FAC282203A28A004C7337 /* Friend.swift */, + 481FAC2B2203AFC7004C7337 /* NavigationControllerDelegate.swift */, + 481FAC2D2203B1F7004C7337 /* Animator.swift */, + 48246D2A2203A14500DC2AA1 /* TableViewCell.swift */, + 481FAC2A2203AFA5004C7337 /* Controllers */, + 48246D1A22038C8900DC2AA1 /* Main.storyboard */, + 48246D1D22038C8B00DC2AA1 /* Assets.xcassets */, + 48246D1F22038C8B00DC2AA1 /* LaunchScreen.storyboard */, + 48246D2222038C8B00DC2AA1 /* Info.plist */, + ); + path = Friends; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 48246D1222038C8900DC2AA1 /* Friends */ = { + isa = PBXNativeTarget; + buildConfigurationList = 48246D2522038C8B00DC2AA1 /* Build configuration list for PBXNativeTarget "Friends" */; + buildPhases = ( + 48246D0F22038C8900DC2AA1 /* Sources */, + 48246D1022038C8900DC2AA1 /* Frameworks */, + 48246D1122038C8900DC2AA1 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Friends; + productName = Friends; + productReference = 48246D1322038C8900DC2AA1 /* Friends.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 48246D0B22038C8900DC2AA1 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1010; + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = Frulwinn; + TargetAttributes = { + 48246D1222038C8900DC2AA1 = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = 48246D0E22038C8900DC2AA1 /* Build configuration list for PBXProject "Friends" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 48246D0A22038C8900DC2AA1; + productRefGroup = 48246D1422038C8900DC2AA1 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 48246D1222038C8900DC2AA1 /* Friends */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 48246D1122038C8900DC2AA1 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 48246D2122038C8B00DC2AA1 /* LaunchScreen.storyboard in Resources */, + 48246D1E22038C8B00DC2AA1 /* Assets.xcassets in Resources */, + 48246D1C22038C8900DC2AA1 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 48246D0F22038C8900DC2AA1 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 48246D1922038C8900DC2AA1 /* DetailViewController.swift in Sources */, + 48246D2B2203A14500DC2AA1 /* TableViewCell.swift in Sources */, + 481FAC292203A28A004C7337 /* Friend.swift in Sources */, + 48246D292203A0D000DC2AA1 /* TableViewController.swift in Sources */, + 481FAC2C2203AFC7004C7337 /* NavigationControllerDelegate.swift in Sources */, + 48246D1722038C8900DC2AA1 /* AppDelegate.swift in Sources */, + 481FAC2E2203B1F7004C7337 /* Animator.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 48246D1A22038C8900DC2AA1 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 48246D1B22038C8900DC2AA1 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 48246D1F22038C8B00DC2AA1 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 48246D2022038C8B00DC2AA1 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 48246D2322038C8B00DC2AA1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 48246D2422038C8B00DC2AA1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 48246D2622038C8B00DC2AA1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = Friends/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.Frulwinn.Friends; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 48246D2722038C8B00DC2AA1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = Friends/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.Frulwinn.Friends; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 48246D0E22038C8900DC2AA1 /* Build configuration list for PBXProject "Friends" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 48246D2322038C8B00DC2AA1 /* Debug */, + 48246D2422038C8B00DC2AA1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 48246D2522038C8B00DC2AA1 /* Build configuration list for PBXNativeTarget "Friends" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 48246D2622038C8B00DC2AA1 /* Debug */, + 48246D2722038C8B00DC2AA1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 48246D0B22038C8900DC2AA1 /* Project object */; +} diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Animator.swift b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Animator.swift new file mode 100644 index 00000000..8e56709b --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Animator.swift @@ -0,0 +1,14 @@ +// Copyright © 2019 Frulwinn. All rights reserved. + +import UIKit + +class Animator: NSObject, UIViewControllerAnimatedTransitioning { + + func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { + return 1.0 + } + + func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { + <#code#> + } +} diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/AppDelegate.swift b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/AppDelegate.swift new file mode 100644 index 00000000..0967882b --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/AppDelegate.swift @@ -0,0 +1,15 @@ +// Copyright © 2019 Frulwinn. All rights reserved. + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + + return true + } +} + diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/AppIcon.appiconset/Contents.json b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d8db8d65 --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/BlackWidow.imageset/BlackWidow.png b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/BlackWidow.imageset/BlackWidow.png new file mode 100644 index 00000000..473a820a Binary files /dev/null and b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/BlackWidow.imageset/BlackWidow.png differ diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/BlackWidow.imageset/Contents.json b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/BlackWidow.imageset/Contents.json new file mode 100644 index 00000000..e1eecc52 --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/BlackWidow.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "BlackWidow.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/Contents.json b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/JeanGray.imageset/Contents.json b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/JeanGray.imageset/Contents.json new file mode 100644 index 00000000..294e34da --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/JeanGray.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "JeanGray.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/JeanGray.imageset/JeanGray.png b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/JeanGray.imageset/JeanGray.png new file mode 100644 index 00000000..e4c4eef3 Binary files /dev/null and b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/JeanGray.imageset/JeanGray.png differ diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/WonderWoman.imageset/Contents.json b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/WonderWoman.imageset/Contents.json new file mode 100644 index 00000000..e4dcc6c7 --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/WonderWoman.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "WonderWoman.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/WonderWoman.imageset/WonderWoman.png b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/WonderWoman.imageset/WonderWoman.png new file mode 100644 index 00000000..43b8171d Binary files /dev/null and b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Assets.xcassets/WonderWoman.imageset/WonderWoman.png differ diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Base.lproj/LaunchScreen.storyboard b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..bfa36129 --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Base.lproj/Main.storyboard b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Base.lproj/Main.storyboard new file mode 100644 index 00000000..95992a07 --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Base.lproj/Main.storyboard @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Controllers/DetailViewController.swift b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Controllers/DetailViewController.swift new file mode 100644 index 00000000..5751086b --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Controllers/DetailViewController.swift @@ -0,0 +1,25 @@ +// Copyright © 2019 Frulwinn. All rights reserved. + +import UIKit + +class DetailViewController: UIViewController { + + var friend: Friend? + + @IBOutlet weak var friendView: UIImageView! + @IBOutlet weak var nameLabel: UILabel! + @IBOutlet weak var infoLabel: UILabel! + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + guard let friend = friend else { return } + friendView.image = friend.friendImage + nameLabel.text = friend.name + infoLabel.text = friend.info + + navigationController?.title = friend.name + } + + +} + diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Controllers/TableViewController.swift b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Controllers/TableViewController.swift new file mode 100644 index 00000000..55d67b71 --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Controllers/TableViewController.swift @@ -0,0 +1,48 @@ +// Copyright © 2019 Frulwinn. All rights reserved. + +import UIKit + +class TableViewController: UITableViewController, UINavigationControllerDelegate { + + var friends: [Friend] = [] + + override func viewDidLoad() { + super.viewDidLoad() + + let navigationControllerDelegate = NavigationControllerDelegate() + + let friend1 = Friend(name: "Wonder Woman", friendImage: UIImage(named: "WonderWoman")!, info: "Amazonian masterful athlete, acrobat, fighter and strategist") + + let friend2 = Friend(name: "Black Widow", friendImage: UIImage(named: "BlackWidow")!, info: "Athlete, gymnast, acrobat, aerialist, and expert martial artist") + + let friend3 = Friend(name: "Jean Grey", friendImage: UIImage(named: "JeanGray")!, info: "Telepathic and telekinetic abilities") + + friends.append(friend1) + friends.append(friend2) + friends.append(friend3) + } + + // MARK: - Table view data source + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return friends.count + } + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + guard let cell = tableView.dequeueReusableCell(withIdentifier: "friendCell", for: indexPath) as? TableViewCell else { fatalError("Unable to dequeue TableViewCell") } + + let friend = friends[indexPath.row] + cell.friendView.image = friend.friendImage + cell.nameLabel.text = friend.name + return cell + } + + // MARK: - Navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + guard let indexPath = tableView.indexPathForSelectedRow else { return } + guard let destination = segue.destination as? DetailViewController else { return } + + destination.friend = friends[indexPath.row] + + //Get the tapped row, and use it to give the navigation controller delegate the source table view cell + } +} diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Friend.swift b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Friend.swift new file mode 100644 index 00000000..8c873a6d --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Friend.swift @@ -0,0 +1,9 @@ +// Copyright © 2019 Frulwinn. All rights reserved. + +import UIKit + +struct Friend { + var name: String + var friendImage: UIImage + var info: String +} diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Info.plist b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Info.plist new file mode 100644 index 00000000..16be3b68 --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/NavigationControllerDelegate.swift b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/NavigationControllerDelegate.swift new file mode 100644 index 00000000..a22a83f8 --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/NavigationControllerDelegate.swift @@ -0,0 +1,14 @@ +// Copyright © 2019 Frulwinn. All rights reserved. + +import UIKit + +class NavigationControllerDelegate: NSObject, UINavigationControllerDelegate { + + var sourceCell: TableViewCell + + func navigationController(_ navigationController:, animationControllerFor:, from:, to:) { + return animator + } + + let animator = Animator() +} diff --git a/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/TableViewCell.swift b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/TableViewCell.swift new file mode 100644 index 00000000..f69548a3 --- /dev/null +++ b/Sprint 6/Module 4 - View Controller Transitions/Friends/Friends/TableViewCell.swift @@ -0,0 +1,11 @@ +// Copyright © 2019 Frulwinn. All rights reserved. + +import UIKit + +class TableViewCell: UITableViewCell { + + @IBOutlet weak var friendView: UIImageView! + @IBOutlet weak var nameLabel: UILabel! + + +} diff --git a/Sprint 7/Concurrency II (7.3)/HungryDevelopers.playground/Contents.swift b/Sprint 7/Concurrency II (7.3)/HungryDevelopers.playground/Contents.swift new file mode 100644 index 00000000..fae8fbed --- /dev/null +++ b/Sprint 7/Concurrency II (7.3)/HungryDevelopers.playground/Contents.swift @@ -0,0 +1,41 @@ +import UIKit + +class Spoon { + let lock = NSLock() + + func pickUp() { + lock.lock() + } + + func putDown() { + lock.unlock() + } +} + +class Developer { + + var leftSpoon: String + var rightSpoon: String + + init(leftSpoon: String, rightSpoon: String) { + self.leftSpoon = leftSpoon + self.rightSpoon = rightSpoon + + } + + func think() { + //pick both spoons before returning + + } + + func eat() { + //shoud pause for random amount of time before putting both spoons down usleep() + + } + + func run() { + + + } + +} diff --git a/Sprint 7/Concurrency II (7.3)/HungryDevelopers.playground/contents.xcplayground b/Sprint 7/Concurrency II (7.3)/HungryDevelopers.playground/contents.xcplayground new file mode 100644 index 00000000..9f5f2f40 --- /dev/null +++ b/Sprint 7/Concurrency II (7.3)/HungryDevelopers.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Sprint 7/Generics (7.2)/Generics.playground/Contents.swift b/Sprint 7/Generics (7.2)/Generics.playground/Contents.swift new file mode 100644 index 00000000..99c1ae93 --- /dev/null +++ b/Sprint 7/Generics (7.2)/Generics.playground/Contents.swift @@ -0,0 +1,57 @@ +import UIKit + +//Generics Challenge +//A counted set is an unordered collection of unique elements that may appear more than once in the collection. + +// Create a generic CountedSet struct that is constrained to Hashable elements. +struct CountedSet { + + // Use a private dictionary as your backing storage for set members and their counts. + private var dictionary: [Element: Int] = [:] + +// Add insertion, insert one element at a time. + mutating func insert(element: Element) { + if let existingValue = dictionary[element] { + let newValue = existingValue + 1 + dictionary[element] = newValue + } else { + dictionary[element] = 1 + } + } + +// Add removal, remove one element at a time. + mutating func remove(element: Element) -> Element? { + if let existingValue = dictionary[element] { + let revisedValue = existingValue - 1 + if revisedValue > 0 { + dictionary[element] = revisedValue + } else { + dictionary[element] = nil + return nil + } + } + return element + } + +// Support subscripting to look up current values (by implementing subscript(_ member: Element) -> Int). +// Return 0 for any value that is not found. + subscript(_ element: Element) -> Int { + // Return 0 for any value not found + return dictionary[element] ?? 0 + } + +// Add count, returning the number of unique elements in the counted set and isEmpty for when count is zero. + func isEmpty() -> Bool { + var count: Int { + return dictionary.count + } + + if count == 0 { + return true + } else { + return false + } + } + + +} diff --git a/Sprint 7/Generics (7.2)/Generics.playground/contents.xcplayground b/Sprint 7/Generics (7.2)/Generics.playground/contents.xcplayground new file mode 100644 index 00000000..9f5f2f40 --- /dev/null +++ b/Sprint 7/Generics (7.2)/Generics.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file