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..6ae20007 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl.xcodeproj/project.pbxproj @@ -0,0 +1,345 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + A57C44AE21E53AE80080E970 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A57C44AD21E53AE80080E970 /* AppDelegate.swift */; }; + A57C44B021E53AE80080E970 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A57C44AF21E53AE80080E970 /* ViewController.swift */; }; + A57C44B321E53AE80080E970 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A57C44B121E53AE80080E970 /* Main.storyboard */; }; + A57C44B521E53AE90080E970 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A57C44B421E53AE90080E970 /* Assets.xcassets */; }; + A57C44B821E53AE90080E970 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A57C44B621E53AE90080E970 /* LaunchScreen.storyboard */; }; + A57C44C021E53BC20080E970 /* CustomControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = A57C44BF21E53BC20080E970 /* CustomControl.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + A57C44AA21E53AE80080E970 /* UIControl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UIControl.app; sourceTree = BUILT_PRODUCTS_DIR; }; + A57C44AD21E53AE80080E970 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + A57C44AF21E53AE80080E970 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + A57C44B221E53AE80080E970 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + A57C44B421E53AE90080E970 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + A57C44B721E53AE90080E970 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + A57C44B921E53AE90080E970 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A57C44BF21E53BC20080E970 /* CustomControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomControl.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A57C44A721E53AE80080E970 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A57C44A121E53AE80080E970 = { + isa = PBXGroup; + children = ( + A57C44AC21E53AE80080E970 /* UIControl */, + A57C44AB21E53AE80080E970 /* Products */, + ); + sourceTree = ""; + }; + A57C44AB21E53AE80080E970 /* Products */ = { + isa = PBXGroup; + children = ( + A57C44AA21E53AE80080E970 /* UIControl.app */, + ); + name = Products; + sourceTree = ""; + }; + A57C44AC21E53AE80080E970 /* UIControl */ = { + isa = PBXGroup; + children = ( + A57C44AD21E53AE80080E970 /* AppDelegate.swift */, + A57C44AF21E53AE80080E970 /* ViewController.swift */, + A57C44B121E53AE80080E970 /* Main.storyboard */, + A57C44BF21E53BC20080E970 /* CustomControl.swift */, + A57C44B421E53AE90080E970 /* Assets.xcassets */, + A57C44B621E53AE90080E970 /* LaunchScreen.storyboard */, + A57C44B921E53AE90080E970 /* Info.plist */, + ); + path = UIControl; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A57C44A921E53AE80080E970 /* UIControl */ = { + isa = PBXNativeTarget; + buildConfigurationList = A57C44BC21E53AE90080E970 /* Build configuration list for PBXNativeTarget "UIControl" */; + buildPhases = ( + A57C44A621E53AE80080E970 /* Sources */, + A57C44A721E53AE80080E970 /* Frameworks */, + A57C44A821E53AE80080E970 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = UIControl; + productName = UIControl; + productReference = A57C44AA21E53AE80080E970 /* UIControl.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A57C44A221E53AE80080E970 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1010; + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = "Sergey Osipyan"; + TargetAttributes = { + A57C44A921E53AE80080E970 = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = A57C44A521E53AE80080E970 /* Build configuration list for PBXProject "UIControl" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = A57C44A121E53AE80080E970; + productRefGroup = A57C44AB21E53AE80080E970 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + A57C44A921E53AE80080E970 /* UIControl */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + A57C44A821E53AE80080E970 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A57C44B821E53AE90080E970 /* LaunchScreen.storyboard in Resources */, + A57C44B521E53AE90080E970 /* Assets.xcassets in Resources */, + A57C44B321E53AE80080E970 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + A57C44A621E53AE80080E970 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A57C44B021E53AE80080E970 /* ViewController.swift in Sources */, + A57C44C021E53BC20080E970 /* CustomControl.swift in Sources */, + A57C44AE21E53AE80080E970 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + A57C44B121E53AE80080E970 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + A57C44B221E53AE80080E970 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + A57C44B621E53AE90080E970 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + A57C44B721E53AE90080E970 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + A57C44BA21E53AE90080E970 /* 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; + }; + A57C44BB21E53AE90080E970 /* 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; + }; + A57C44BD21E53AE90080E970 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KF4QEGAU36; + INFOPLIST_FILE = UIControl/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.UIControl; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + A57C44BE21E53AE90080E970 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KF4QEGAU36; + INFOPLIST_FILE = UIControl/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.UIControl; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A57C44A521E53AE80080E970 /* Build configuration list for PBXProject "UIControl" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A57C44BA21E53AE90080E970 /* Debug */, + A57C44BB21E53AE90080E970 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A57C44BC21E53AE90080E970 /* Build configuration list for PBXNativeTarget "UIControl" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A57C44BD21E53AE90080E970 /* Debug */, + A57C44BE21E53AE90080E970 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = A57C44A221E53AE80080E970 /* 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..699afe75 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// UIControl +// +// Created by Sergey Osipyan on 1/8/19. +// Copyright © 2019 Sergey Osipyan. 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 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..8b39ee51 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/Base.lproj/Main.storyboard @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..b6f9068f --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/CustomControl.swift @@ -0,0 +1,124 @@ +// +// CustomControl.swift +// UIControl +// +// Created by Sergey Osipyan on 1/8/19. +// Copyright © 2019 Sergey Osipyan. All rights reserved. +// + +import UIKit + +class CustomControl: UIControl { + + + static var value: Int = 1 + + private let componentDimension: CGFloat = 40.0 + private let componentCount = 5 + private let componentActiveColor = UIColor.black + private let componentInactiveColor = UIColor.gray + + required init?(coder aCoder: NSCoder) { + super.init(coder: aCoder) + setup() + + } + + var labels: [UILabel] = [] + + func setup() { + + var tags: [Int] = [] + var coordinate: CGFloat = 8.0 + for number in 1...6 { + + var label = UILabel() + + + let location: CGFloat = coordinate + label = UILabel(frame: CGRect(x: location, y: 0.0, width: componentDimension, height: componentDimension)) + label.tag = number + label.font = UIFont.boldSystemFont(ofSize: 32.0) + label.text = "✯" + label.textAlignment = .center + label.textColor = componentInactiveColor + self.addSubview(label) + labels.append(label) + tags.append(tag) + coordinate += 48 + + + } + } + + + + override var intrinsicContentSize: CGSize { + let componentsWidth = CGFloat(componentCount) * componentDimension + let componentsSpacing = CGFloat(componentCount + 7) * 8.0 + let width = componentsWidth + componentsSpacing + return CGSize(width: width, height: componentDimension) + } + + override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool { + updateValue(at: touch) + sendActions(for: [.touchDown, .valueChanged]) + return true + } + + override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool { + let touchPoint = touch.location(in: self) + if bounds.contains(touchPoint){ + self.updateValue(at: touch) + sendActions(for: [.touchDragInside, .valueChanged]) + } else { + sendActions(for: [.touchDragOutside]) + } + return true + } + + override func endTracking(_ touch: UITouch?, with event: UIEvent?) { + guard let touchPoint = touch?.location(in: self) else {return} + if bounds.contains(touchPoint){ + self.updateValue(at: touch!) + sendActions(for: [.touchUpInside, .valueChanged]) + } else { + sendActions(for: [.touchUpOutside]) + } + } + + override func cancelTracking(with event: UIEvent?) { + sendActions(for: .touchCancel) + super.cancelTracking(with: event) + } + + func updateValue(at touch: UITouch ) { + for label in labels { + let touchPoint = touch.location(in: label) + if bounds.contains(touchPoint) { CustomControl.value = label.tag } + if CustomControl.value >= label.tag { + label.textColor = componentActiveColor + label.performFlare() + + } else { + label.textColor = componentInactiveColor + } + sendActions(for: [.valueChanged]) + } + } + +} + extension UIView { + // "Flare view" animation sequence + func performFlare() { + func flare() { transform = CGAffineTransform(scaleX: 2.0, y: 2.0) + transform = CGAffineTransform(rotationAngle: 15.0) } + func unflare() { transform = .identity } + + UIView.animate(withDuration: 0.3, + animations: { flare() }, + completion: { _ in UIView.animate(withDuration: 0.1) { unflare() }}) + } + } + + 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..c23ead62 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControl/UIControl/ViewController.swift @@ -0,0 +1,32 @@ +// +// ViewController.swift +// UIControl +// +// Created by Sergey Osipyan on 1/8/19. +// Copyright © 2019 Sergey Osipyan. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + + + } + + @IBAction func updateRating(_ ratingControl: CustomControl) { + + if CustomControl.value < 2 { + self.navigationItem.title = "User Rating: \(CustomControl.value) star" + } else { + + self.navigationItem.title = "User Rating: \(CustomControl.value) stars" + + } + + +} + +} diff --git a/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl.xcodeproj/project.pbxproj b/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl.xcodeproj/project.pbxproj new file mode 100644 index 00000000..6ae20007 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl.xcodeproj/project.pbxproj @@ -0,0 +1,345 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + A57C44AE21E53AE80080E970 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A57C44AD21E53AE80080E970 /* AppDelegate.swift */; }; + A57C44B021E53AE80080E970 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A57C44AF21E53AE80080E970 /* ViewController.swift */; }; + A57C44B321E53AE80080E970 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A57C44B121E53AE80080E970 /* Main.storyboard */; }; + A57C44B521E53AE90080E970 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A57C44B421E53AE90080E970 /* Assets.xcassets */; }; + A57C44B821E53AE90080E970 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A57C44B621E53AE90080E970 /* LaunchScreen.storyboard */; }; + A57C44C021E53BC20080E970 /* CustomControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = A57C44BF21E53BC20080E970 /* CustomControl.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + A57C44AA21E53AE80080E970 /* UIControl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UIControl.app; sourceTree = BUILT_PRODUCTS_DIR; }; + A57C44AD21E53AE80080E970 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + A57C44AF21E53AE80080E970 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + A57C44B221E53AE80080E970 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + A57C44B421E53AE90080E970 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + A57C44B721E53AE90080E970 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + A57C44B921E53AE90080E970 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A57C44BF21E53BC20080E970 /* CustomControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomControl.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A57C44A721E53AE80080E970 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A57C44A121E53AE80080E970 = { + isa = PBXGroup; + children = ( + A57C44AC21E53AE80080E970 /* UIControl */, + A57C44AB21E53AE80080E970 /* Products */, + ); + sourceTree = ""; + }; + A57C44AB21E53AE80080E970 /* Products */ = { + isa = PBXGroup; + children = ( + A57C44AA21E53AE80080E970 /* UIControl.app */, + ); + name = Products; + sourceTree = ""; + }; + A57C44AC21E53AE80080E970 /* UIControl */ = { + isa = PBXGroup; + children = ( + A57C44AD21E53AE80080E970 /* AppDelegate.swift */, + A57C44AF21E53AE80080E970 /* ViewController.swift */, + A57C44B121E53AE80080E970 /* Main.storyboard */, + A57C44BF21E53BC20080E970 /* CustomControl.swift */, + A57C44B421E53AE90080E970 /* Assets.xcassets */, + A57C44B621E53AE90080E970 /* LaunchScreen.storyboard */, + A57C44B921E53AE90080E970 /* Info.plist */, + ); + path = UIControl; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A57C44A921E53AE80080E970 /* UIControl */ = { + isa = PBXNativeTarget; + buildConfigurationList = A57C44BC21E53AE90080E970 /* Build configuration list for PBXNativeTarget "UIControl" */; + buildPhases = ( + A57C44A621E53AE80080E970 /* Sources */, + A57C44A721E53AE80080E970 /* Frameworks */, + A57C44A821E53AE80080E970 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = UIControl; + productName = UIControl; + productReference = A57C44AA21E53AE80080E970 /* UIControl.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A57C44A221E53AE80080E970 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1010; + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = "Sergey Osipyan"; + TargetAttributes = { + A57C44A921E53AE80080E970 = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = A57C44A521E53AE80080E970 /* Build configuration list for PBXProject "UIControl" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = A57C44A121E53AE80080E970; + productRefGroup = A57C44AB21E53AE80080E970 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + A57C44A921E53AE80080E970 /* UIControl */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + A57C44A821E53AE80080E970 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A57C44B821E53AE90080E970 /* LaunchScreen.storyboard in Resources */, + A57C44B521E53AE90080E970 /* Assets.xcassets in Resources */, + A57C44B321E53AE80080E970 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + A57C44A621E53AE80080E970 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A57C44B021E53AE80080E970 /* ViewController.swift in Sources */, + A57C44C021E53BC20080E970 /* CustomControl.swift in Sources */, + A57C44AE21E53AE80080E970 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + A57C44B121E53AE80080E970 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + A57C44B221E53AE80080E970 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + A57C44B621E53AE90080E970 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + A57C44B721E53AE90080E970 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + A57C44BA21E53AE90080E970 /* 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; + }; + A57C44BB21E53AE90080E970 /* 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; + }; + A57C44BD21E53AE90080E970 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KF4QEGAU36; + INFOPLIST_FILE = UIControl/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.UIControl; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + A57C44BE21E53AE90080E970 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KF4QEGAU36; + INFOPLIST_FILE = UIControl/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.UIControl; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A57C44A521E53AE80080E970 /* Build configuration list for PBXProject "UIControl" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A57C44BA21E53AE90080E970 /* Debug */, + A57C44BB21E53AE90080E970 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A57C44BC21E53AE90080E970 /* Build configuration list for PBXNativeTarget "UIControl" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A57C44BD21E53AE90080E970 /* Debug */, + A57C44BE21E53AE90080E970 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = A57C44A221E53AE80080E970 /* Project object */; +} diff --git a/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/AppDelegate.swift b/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/AppDelegate.swift new file mode 100644 index 00000000..699afe75 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// UIControl +// +// Created by Sergey Osipyan on 1/8/19. +// Copyright © 2019 Sergey Osipyan. 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 2-Custom Controls/UIControlAsync/UIControl/Assets.xcassets/AppIcon.appiconset/Contents.json b/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d8db8d65 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControlAsync/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/UIControlAsync/UIControl/Assets.xcassets/Contents.json b/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/Assets.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControlAsync/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/UIControlAsync/UIControl/Base.lproj/LaunchScreen.storyboard b/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..bfa36129 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/Base.lproj/Main.storyboard b/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/Base.lproj/Main.storyboard new file mode 100644 index 00000000..475b00b1 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/Base.lproj/Main.storyboard @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/CustomControl.swift b/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/CustomControl.swift new file mode 100644 index 00000000..51661568 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/CustomControl.swift @@ -0,0 +1,123 @@ +// +// CustomControl.swift +// UIControl +// +// Created by Sergey Osipyan on 1/8/19. +// Copyright © 2019 Sergey Osipyan. All rights reserved. +// + +import UIKit + +class CustomControl: UIControl { + + + static var value: Int = 1 + + private let componentDimension: CGFloat = 40.0 + private let componentCount = 5 + private let componentActiveColor = UIColor.black + private let componentInactiveColor = UIColor.gray + + required init?(coder aCoder: NSCoder) { + super.init(coder: aCoder) + setup() + + } + + var labels: [UILabel] = [] + + func setup() { + + var tags: [Int] = [] + var coordinate: CGFloat = 8.0 + for number in 1...6 { + + var label = UILabel() + + + let location: CGFloat = coordinate + label = UILabel(frame: CGRect(x: location, y: 0.0, width: componentDimension, height: componentDimension)) + label.tag = number + label.font = UIFont.boldSystemFont(ofSize: 32.0) + label.text = "✯" + label.textAlignment = .center + label.textColor = componentInactiveColor + self.addSubview(label) + labels.append(label) + tags.append(tag) + coordinate += 48 + + + } + } + + + + override var intrinsicContentSize: CGSize { + let componentsWidth = CGFloat(componentCount) * componentDimension + let componentsSpacing = CGFloat(componentCount + 7) * 8.0 + let width = componentsWidth + componentsSpacing + return CGSize(width: width, height: componentDimension) + } + + override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool { + updateValue(at: touch) + sendActions(for: [.touchDown, .valueChanged]) + return true + } + + override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool { + let touchPoint = touch.location(in: self) + if bounds.contains(touchPoint){ + updateValue(at: touch) + sendActions(for: [.touchDragInside, .valueChanged]) + } else { + sendActions(for: [.touchDragOutside]) + } + return true + } + + override func endTracking(_ touch: UITouch?, with event: UIEvent?) { + guard let touch = touch else { return } + let touchPoint = touch.location(in: self) + if bounds.contains(touchPoint){ + updateValue(at: touch) + sendActions(for: [.touchUpInside, .valueChanged]) + } else { + sendActions(for: [.touchUpOutside]) + } + } + + override func cancelTracking(with event: UIEvent?) { + sendActions(for: .touchCancel) + super.cancelTracking(with: event) + } + + func updateValue(at touch: UITouch ) { + for label in labels { + let touchPoint = touch.location(in: label) + if bounds.contains(touchPoint) { CustomControl.value = label.tag } + if CustomControl.value >= label.tag { + label.textColor = componentActiveColor + label.performFlare() + + } else { + label.textColor = componentInactiveColor + } + sendActions(for: [.valueChanged]) + } + } + +} +extension UIView { + // "Flare view" animation sequence + func performFlare() { + func flare() { transform = CGAffineTransform(scaleX: 2.0, y: 2.0) + transform = CGAffineTransform(rotationAngle: 15.0) } + func unflare() { transform = .identity } + + UIView.animate(withDuration: 0.3, + animations: { flare() }, + completion: { _ in UIView.animate(withDuration: 0.1) { unflare() }}) + } +} diff --git a/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/Info.plist b/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/Info.plist new file mode 100644 index 00000000..16be3b68 --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControlAsync/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/UIControlAsync/UIControl/ViewController.swift b/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/ViewController.swift new file mode 100644 index 00000000..805dfa8d --- /dev/null +++ b/Sprint 6/Module 2-Custom Controls/UIControlAsync/UIControl/ViewController.swift @@ -0,0 +1,32 @@ +// +// ViewController.swift +// UIControl +// +// Created by Sergey Osipyan on 1/8/19. +// Copyright © 2019 Sergey Osipyan. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = .yellow + + } + + @IBAction func updateRating(_ ratingControl: CustomControl) { + + if CustomControl.value < 2 { + self.navigationItem.title = "User Rating: \(CustomControl.value) star" + } else { + + self.navigationItem.title = "User Rating: \(CustomControl.value) stars" + + } + + +} + +} diff --git a/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints.xcodeproj/project.pbxproj b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints.xcodeproj/project.pbxproj new file mode 100644 index 00000000..91bc6d13 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints.xcodeproj/project.pbxproj @@ -0,0 +1,341 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + A513CCAC21EF9CD000857436 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A513CCAB21EF9CD000857436 /* AppDelegate.swift */; }; + A513CCAE21EF9CD000857436 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A513CCAD21EF9CD000857436 /* ViewController.swift */; }; + A513CCB121EF9CD000857436 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A513CCAF21EF9CD000857436 /* Main.storyboard */; }; + A513CCB321EF9CD400857436 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A513CCB221EF9CD400857436 /* Assets.xcassets */; }; + A513CCB621EF9CD400857436 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A513CCB421EF9CD400857436 /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + A513CCA821EF9CD000857436 /* Constraints.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Constraints.app; sourceTree = BUILT_PRODUCTS_DIR; }; + A513CCAB21EF9CD000857436 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + A513CCAD21EF9CD000857436 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + A513CCB021EF9CD000857436 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + A513CCB221EF9CD400857436 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + A513CCB521EF9CD400857436 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + A513CCB721EF9CD400857436 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A513CCA521EF9CD000857436 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A513CC9F21EF9CD000857436 = { + isa = PBXGroup; + children = ( + A513CCAA21EF9CD000857436 /* Constraints */, + A513CCA921EF9CD000857436 /* Products */, + ); + sourceTree = ""; + }; + A513CCA921EF9CD000857436 /* Products */ = { + isa = PBXGroup; + children = ( + A513CCA821EF9CD000857436 /* Constraints.app */, + ); + name = Products; + sourceTree = ""; + }; + A513CCAA21EF9CD000857436 /* Constraints */ = { + isa = PBXGroup; + children = ( + A513CCAB21EF9CD000857436 /* AppDelegate.swift */, + A513CCAD21EF9CD000857436 /* ViewController.swift */, + A513CCAF21EF9CD000857436 /* Main.storyboard */, + A513CCB221EF9CD400857436 /* Assets.xcassets */, + A513CCB421EF9CD400857436 /* LaunchScreen.storyboard */, + A513CCB721EF9CD400857436 /* Info.plist */, + ); + path = Constraints; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A513CCA721EF9CD000857436 /* Constraints */ = { + isa = PBXNativeTarget; + buildConfigurationList = A513CCBA21EF9CD400857436 /* Build configuration list for PBXNativeTarget "Constraints" */; + buildPhases = ( + A513CCA421EF9CD000857436 /* Sources */, + A513CCA521EF9CD000857436 /* Frameworks */, + A513CCA621EF9CD000857436 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Constraints; + productName = Constraints; + productReference = A513CCA821EF9CD000857436 /* Constraints.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A513CCA021EF9CD000857436 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1010; + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = "Sergey Osipyan"; + TargetAttributes = { + A513CCA721EF9CD000857436 = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = A513CCA321EF9CD000857436 /* Build configuration list for PBXProject "Constraints" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = A513CC9F21EF9CD000857436; + productRefGroup = A513CCA921EF9CD000857436 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + A513CCA721EF9CD000857436 /* Constraints */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + A513CCA621EF9CD000857436 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A513CCB621EF9CD400857436 /* LaunchScreen.storyboard in Resources */, + A513CCB321EF9CD400857436 /* Assets.xcassets in Resources */, + A513CCB121EF9CD000857436 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + A513CCA421EF9CD000857436 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A513CCAE21EF9CD000857436 /* ViewController.swift in Sources */, + A513CCAC21EF9CD000857436 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + A513CCAF21EF9CD000857436 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + A513CCB021EF9CD000857436 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + A513CCB421EF9CD400857436 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + A513CCB521EF9CD400857436 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + A513CCB821EF9CD400857436 /* 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; + }; + A513CCB921EF9CD400857436 /* 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; + }; + A513CCBB21EF9CD400857436 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KF4QEGAU36; + INFOPLIST_FILE = Constraints/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.Constraints; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + A513CCBC21EF9CD400857436 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KF4QEGAU36; + INFOPLIST_FILE = Constraints/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.Constraints; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A513CCA321EF9CD000857436 /* Build configuration list for PBXProject "Constraints" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A513CCB821EF9CD400857436 /* Debug */, + A513CCB921EF9CD400857436 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A513CCBA21EF9CD400857436 /* Build configuration list for PBXNativeTarget "Constraints" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A513CCBB21EF9CD400857436 /* Debug */, + A513CCBC21EF9CD400857436 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = A513CCA021EF9CD000857436 /* Project object */; +} diff --git a/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/AppDelegate.swift b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/AppDelegate.swift new file mode 100644 index 00000000..c298419a --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// Constraints +// +// Created by Sergey Osipyan on 1/16/19. +// Copyright © 2019 Sergey Osipyan. 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/Constraints/Constraints/Constraints/Assets.xcassets/AppIcon.appiconset/Contents.json b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d8db8d65 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/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/Constraints/Constraints/Constraints/Assets.xcassets/Contents.json b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/Assets.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/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/Constraints/Constraints/Constraints/Base.lproj/LaunchScreen.storyboard b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..bfa36129 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/Base.lproj/Main.storyboard b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/Base.lproj/Main.storyboard new file mode 100644 index 00000000..3504db5b --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/Base.lproj/Main.storyboard @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/Info.plist b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/Info.plist new file mode 100644 index 00000000..16be3b68 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/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/Constraints/Constraints/Constraints/ViewController.swift b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/ViewController.swift new file mode 100644 index 00000000..1187d15b --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/Constraints/Constraints/Constraints/ViewController.swift @@ -0,0 +1,104 @@ +// +// ViewController.swift +// Constraints +// +// Created by Sergey Osipyan on 1/16/19. +// Copyright © 2019 Sergey Osipyan. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + + + + override func viewDidLoad() { + super.viewDidLoad() + + let greeenSquare = UIView() + greeenSquare.backgroundColor = .green + view.addSubview(greeenSquare) + greeenSquare.translatesAutoresizingMaskIntoConstraints = false + + let purpleSquare = UIView() + purpleSquare.backgroundColor = .purple + view.addSubview(purpleSquare) + purpleSquare.translatesAutoresizingMaskIntoConstraints = false + + let widthConstraint = NSLayoutConstraint(item: greeenSquare, + attribute: .width, + relatedBy: .equal, + toItem: nil, + attribute: .notAnAttribute, + multiplier: 1.0, + constant: 200.0) + + let heightConstraint = NSLayoutConstraint(item: greeenSquare, + attribute: .height, + relatedBy: .equal, + toItem: greeenSquare, + attribute: .width, + multiplier: 1.0, + constant: 0.0) + + let centerYConstraint = NSLayoutConstraint(item: greeenSquare, + attribute: .centerY, + relatedBy: .equal, + toItem: view, + attribute: .centerY, + multiplier: 1.0, + constant: 0.0) + + let centerXConstraint = NSLayoutConstraint(item: greeenSquare, + attribute: .centerX, + relatedBy: .equal, + toItem: view, + attribute: .centerX, + multiplier: 1.0, + constant: 0.0) + + + NSLayoutConstraint.activate([heightConstraint, widthConstraint, centerXConstraint, centerYConstraint]) + + + + let topConstraintPurpleSquare = NSLayoutConstraint(item: purpleSquare, + attribute: .top, + relatedBy: .equal, + toItem: greeenSquare, + attribute: .bottom, + multiplier: 1.0, + constant: 20.0) + + let widthConstraintPurpleSquare = NSLayoutConstraint(item: purpleSquare, + attribute: .width, + relatedBy: .equal, + toItem: greeenSquare, + attribute: .width, + multiplier: 1.0, + constant: 0.0) + + let bottomConstraintPurpleSquare = NSLayoutConstraint(item: view, + attribute: .bottom, + relatedBy: .equal, + toItem: purpleSquare, + attribute: .bottom, + multiplier: 1.0, + constant: 20.0) + + let centerXConstraintPurpleSquare = NSLayoutConstraint(item: purpleSquare, + attribute: .centerX, + relatedBy: .equal, + toItem: view, + attribute: .centerX, + multiplier: 1.0, + constant: 90.0) + + NSLayoutConstraint.activate([widthConstraintPurpleSquare, topConstraintPurpleSquare , centerXConstraintPurpleSquare, bottomConstraintPurpleSquare]) + + } + + +} + diff --git a/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation.xcodeproj/project.pbxproj b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation.xcodeproj/project.pbxproj new file mode 100755 index 00000000..5896d923 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation.xcodeproj/project.pbxproj @@ -0,0 +1,341 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + A52B73C121E666D8004CD524 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52B73C021E666D8004CD524 /* AppDelegate.swift */; }; + A52B73C321E666D8004CD524 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52B73C221E666D8004CD524 /* ViewController.swift */; }; + A52B73C621E666D8004CD524 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A52B73C421E666D8004CD524 /* Main.storyboard */; }; + A52B73C821E666DB004CD524 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A52B73C721E666DB004CD524 /* Assets.xcassets */; }; + A52B73CB21E666DB004CD524 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A52B73C921E666DB004CD524 /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + A52B73BD21E666D8004CD524 /* UIAnimation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UIAnimation.app; sourceTree = BUILT_PRODUCTS_DIR; }; + A52B73C021E666D8004CD524 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + A52B73C221E666D8004CD524 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + A52B73C521E666D8004CD524 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + A52B73C721E666DB004CD524 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + A52B73CA21E666DB004CD524 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + A52B73CC21E666DB004CD524 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A52B73BA21E666D8004CD524 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A52B73B421E666D8004CD524 = { + isa = PBXGroup; + children = ( + A52B73BF21E666D8004CD524 /* UIAnimation */, + A52B73BE21E666D8004CD524 /* Products */, + ); + sourceTree = ""; + }; + A52B73BE21E666D8004CD524 /* Products */ = { + isa = PBXGroup; + children = ( + A52B73BD21E666D8004CD524 /* UIAnimation.app */, + ); + name = Products; + sourceTree = ""; + }; + A52B73BF21E666D8004CD524 /* UIAnimation */ = { + isa = PBXGroup; + children = ( + A52B73C021E666D8004CD524 /* AppDelegate.swift */, + A52B73C221E666D8004CD524 /* ViewController.swift */, + A52B73C421E666D8004CD524 /* Main.storyboard */, + A52B73C721E666DB004CD524 /* Assets.xcassets */, + A52B73C921E666DB004CD524 /* LaunchScreen.storyboard */, + A52B73CC21E666DB004CD524 /* Info.plist */, + ); + path = UIAnimation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A52B73BC21E666D8004CD524 /* UIAnimation */ = { + isa = PBXNativeTarget; + buildConfigurationList = A52B73CF21E666DB004CD524 /* Build configuration list for PBXNativeTarget "UIAnimation" */; + buildPhases = ( + A52B73B921E666D8004CD524 /* Sources */, + A52B73BA21E666D8004CD524 /* Frameworks */, + A52B73BB21E666D8004CD524 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = UIAnimation; + productName = UIAnimation; + productReference = A52B73BD21E666D8004CD524 /* UIAnimation.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A52B73B521E666D8004CD524 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1010; + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = "Sergey Osipyan"; + TargetAttributes = { + A52B73BC21E666D8004CD524 = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = A52B73B821E666D8004CD524 /* Build configuration list for PBXProject "UIAnimation" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = A52B73B421E666D8004CD524; + productRefGroup = A52B73BE21E666D8004CD524 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + A52B73BC21E666D8004CD524 /* UIAnimation */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + A52B73BB21E666D8004CD524 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A52B73CB21E666DB004CD524 /* LaunchScreen.storyboard in Resources */, + A52B73C821E666DB004CD524 /* Assets.xcassets in Resources */, + A52B73C621E666D8004CD524 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + A52B73B921E666D8004CD524 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A52B73C321E666D8004CD524 /* ViewController.swift in Sources */, + A52B73C121E666D8004CD524 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + A52B73C421E666D8004CD524 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + A52B73C521E666D8004CD524 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + A52B73C921E666DB004CD524 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + A52B73CA21E666DB004CD524 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + A52B73CD21E666DB004CD524 /* 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; + }; + A52B73CE21E666DB004CD524 /* 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; + }; + A52B73D021E666DB004CD524 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KF4QEGAU36; + INFOPLIST_FILE = UIAnimation/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.UIAnimation; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + A52B73D121E666DB004CD524 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KF4QEGAU36; + INFOPLIST_FILE = UIAnimation/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.UIAnimation; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A52B73B821E666D8004CD524 /* Build configuration list for PBXProject "UIAnimation" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A52B73CD21E666DB004CD524 /* Debug */, + A52B73CE21E666DB004CD524 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A52B73CF21E666DB004CD524 /* Build configuration list for PBXNativeTarget "UIAnimation" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A52B73D021E666DB004CD524 /* Debug */, + A52B73D121E666DB004CD524 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = A52B73B521E666D8004CD524 /* Project object */; +} diff --git a/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/AppDelegate.swift b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/AppDelegate.swift new file mode 100755 index 00000000..d9335114 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// UIAnimation +// +// Created by Sergey Osipyan on 1/9/19. +// Copyright © 2019 Sergey Osipyan. 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/UIAnimation/UIAnimation/Assets.xcassets/AppIcon.appiconset/Contents.json b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100755 index 00000000..d8db8d65 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/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/UIAnimation/UIAnimation/Assets.xcassets/Contents.json b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/Assets.xcassets/Contents.json new file mode 100755 index 00000000..da4a164c --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/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/UIAnimation/UIAnimation/Assets.xcassets/Lambda_Logo_Full.imageset/Contents.json b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/Assets.xcassets/Lambda_Logo_Full.imageset/Contents.json new file mode 100755 index 00000000..2a92c756 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/Assets.xcassets/Lambda_Logo_Full.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "Lambda_Logo_Full.pdf", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/Assets.xcassets/Lambda_Logo_Full.imageset/Lambda_Logo_Full.pdf b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/Assets.xcassets/Lambda_Logo_Full.imageset/Lambda_Logo_Full.pdf new file mode 100755 index 00000000..3a8651d4 Binary files /dev/null and b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/Assets.xcassets/Lambda_Logo_Full.imageset/Lambda_Logo_Full.pdf differ diff --git a/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/Base.lproj/LaunchScreen.storyboard b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/Base.lproj/LaunchScreen.storyboard new file mode 100755 index 00000000..bfa36129 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/Base.lproj/Main.storyboard b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/Base.lproj/Main.storyboard new file mode 100755 index 00000000..3f1a6292 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/Base.lproj/Main.storyboard @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/Info.plist b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/Info.plist new file mode 100755 index 00000000..16be3b68 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/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/UIAnimation/UIAnimation/ViewController.swift b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/ViewController.swift new file mode 100755 index 00000000..e6368461 --- /dev/null +++ b/Sprint 6/Module 3 - UIView Animation/UIAnimation/UIAnimation/ViewController.swift @@ -0,0 +1,109 @@ +// +// ViewController.swift +// UIAnimation +// +// Created by Sergey Osipyan on 1/9/19. +// Copyright © 2019 Sergey Osipyan. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + navigationItem.title = "Hello!" + view.addSubview(lambdaLogoImage) + lambdaLogoImage.translatesAutoresizingMaskIntoConstraints = false + } + var animationPerformedOnce = false + + override func viewDidAppear(_ animated: Bool) { + super .viewDidAppear(animated) + + + } + + + @IBOutlet weak var stack: UIStackView! + @IBOutlet weak var L: UILabel! + @IBOutlet weak var a: UILabel! + @IBOutlet weak var m: UILabel! + @IBOutlet weak var b: UILabel! + @IBOutlet weak var d: UILabel! + @IBOutlet weak var lastA: UILabel! + @IBOutlet weak var lambdaLogoImage: UIImageView! + @IBAction func toggle(_ sender: Any) { + if shouldScramble { + animation() + } else { + reset() + } + shouldScramble = !shouldScramble + } + + func randomInt(min: Int, max: Int) -> Int { + return min + Int(arc4random_uniform(UInt32(max - min + 1))) + } + + let randColor: [UIColor] = [.red, .blue, .lightGray, .orange, .green, .brown, .yellow] + + var shouldScramble: Bool = true + var LPosition: CGRect = UILabel().frame + var aPosition: CGRect = UILabel().frame + var mPosition: CGRect = UILabel().frame + var bPosition: CGRect = UILabel().frame + var dPosition: CGRect = UILabel().frame + var lastAPosition: CGRect = UILabel().frame + var labelsArray: [UILabel] = [] + + func animation() { + + let labelArray: [UILabel] = [L, a, m, b, d, lastA] + labelsArray = labelArray + LPosition = L.frame + aPosition = a.frame + mPosition = m.frame + bPosition = b.frame + dPosition = d.frame + lastAPosition = lastA.frame + for label in labelArray { + let randCGFloatX = CGFloat.random(in: 0...340) + let randCGFloatY = CGFloat.random(in: 0...650) + let rect = CGRect(x: randCGFloatX, y: randCGFloatY, width: 50, height: 50) + UIView.animate(withDuration: 3) { + label.textColor = self.randColor[self.randomInt(min: 0, max: 6)].withAlphaComponent(1.0) + label.backgroundColor = self.randColor[self.randomInt(min: 0, max: 6)].withAlphaComponent(0.5) + label.frame = rect + label.transform = CGAffineTransform(scaleX: CGFloat(self.randomInt(min: 1, max: 5)), y: CGFloat(self.randomInt(min: 1, max: 5))) + label.transform = CGAffineTransform(rotationAngle: CGFloat(self.randomInt(min: 1, max: 650))) + self.lambdaLogoImage.alpha = 0 + } + } + } + func reset() { + for label in labelsArray { + + UIView.animate(withDuration: 3) { + label.textColor = .black + label.backgroundColor = UIColor.white.withAlphaComponent(0) + self.L.transform = .identity + self.a.transform = .identity + self.m.transform = .identity + self.b.transform = .identity + self.d.transform = .identity + self.lastA.transform = .identity + + self.L.frame = self.LPosition + self.a.frame = self.aPosition + self.m.frame = self.mPosition + self.b.frame = self.bPosition + self.d.frame = self.dPosition + self.lastA.frame = self.lastAPosition + self.lambdaLogoImage.alpha = 1.0 + self.lambdaLogoImage.transform.inverted() + } + } + } +} + diff --git a/Sprint 6/Module 4 - View Controller Transitions/.FriendsAsync.zip.icloud b/Sprint 6/Module 4 - View Controller Transitions/.FriendsAsync.zip.icloud new file mode 100644 index 00000000..dfd2711b Binary files /dev/null and b/Sprint 6/Module 4 - View Controller Transitions/.FriendsAsync.zip.icloud differ diff --git a/Sprint 7/Concurrency II (7.3)/Concurrency II.playground/Contents.swift b/Sprint 7/Concurrency II (7.3)/Concurrency II.playground/Contents.swift new file mode 100644 index 00000000..e6b72325 --- /dev/null +++ b/Sprint 7/Concurrency II (7.3)/Concurrency II.playground/Contents.swift @@ -0,0 +1,109 @@ +import Foundation +import UIKit + +class Spoon { + + var index: Int + + + init(index: Int) { + self.index = index + } + + private let lock = NSLock() + + func pickUp() { + lock.lock() + } + + func putDown() { + lock.unlock() + } + +} + + +class Developer { + + + var leftSpoon: Spoon + var rightSpoon: Spoon + let dev: String + + + init(leftSpoon: Spoon, rightSpoon: Spoon, dev: String) { + self.rightSpoon = rightSpoon + self.leftSpoon = leftSpoon + self.dev = dev + } + + + func think() { + print("\(dev) is thinking ") + if leftSpoon.index < rightSpoon.index { + print("\(dev) is thinking until the left spoon is available") + leftSpoon.pickUp() + print("\(dev) pick up left spoon") + print("\(dev) is thinking until the right spoon is available") + rightSpoon.pickUp() + print("\(dev) pick up right spoon") + + } else { + print("\(dev) is thinking until the right spoon is available") + rightSpoon.pickUp() + print("\(dev) pick up right spoon") + print("\(dev) is thinking until the left spoon is available") + leftSpoon.pickUp() + print("\(dev) pick up left spoon") + + } + } + + func eat() { + + + print("\(dev) is eating") + usleep(useconds_t(Int.random(in: 10000...150_000))) + + rightSpoon.putDown() + print("\(dev) put down right spoon") + + leftSpoon.putDown() + print("\(dev) put down left spoon") + } + + func run() { + + while true { + let startTime = Date() + think() + eat() + let endTime = Date() + let time = endTime.timeIntervalSinceReferenceDate - + startTime.timeIntervalSinceReferenceDate + print("\(dev) eating process takes \(time) seconds") + } + } +} + +let spoon1 = Spoon(index: 1) +let spoon2 = Spoon(index: 2) +let spoon3 = Spoon(index: 3) +let spoon4 = Spoon(index: 4) +let spoon5 = Spoon(index: 5) + +let developer1 = Developer(leftSpoon: spoon1, rightSpoon: spoon2, dev: "don1") +let developer2 = Developer(leftSpoon: spoon2, rightSpoon: spoon3, dev: "dev2") +let developer3 = Developer(leftSpoon: spoon3, rightSpoon: spoon4, dev: "dev3") +let developer4 = Developer(leftSpoon: spoon4, rightSpoon: spoon5, dev: "dev4") +let developer5 = Developer(leftSpoon: spoon5, rightSpoon: spoon1, dev: "dev5") + +let developers = [developer1, developer2, developer3, developer4, developer5] + + +DispatchQueue.concurrentPerform(iterations: 5) { + developers[$0].run() +} + + + diff --git a/Sprint 7/Concurrency II (7.3)/Concurrency II.playground/contents.xcplayground b/Sprint 7/Concurrency II (7.3)/Concurrency II.playground/contents.xcplayground new file mode 100644 index 00000000..9f5f2f40 --- /dev/null +++ b/Sprint 7/Concurrency II (7.3)/Concurrency II.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Sprint 7/Generics (7.2)/GenericChallenge.playground/Contents.swift b/Sprint 7/Generics (7.2)/GenericChallenge.playground/Contents.swift new file mode 100644 index 00000000..ad49e911 --- /dev/null +++ b/Sprint 7/Generics (7.2)/GenericChallenge.playground/Contents.swift @@ -0,0 +1,90 @@ + + + +import UIKit + +struct CountedSet where Element: Hashable { + + + // MARK: - Properties + + private(set) var storage: [Element: Int] = [:] + + var count: Int { + return storage.count + } + + var isEmpty: Bool { + if count == 0 { + return true + } else { + return false + } + } + + + // MARK: - Subscript notation + + subscript(_ element: Element) -> Int { + get { + return storage[element] ?? 0 + } + } + + + // MARK: - Insert and remove + + mutating func insert(_ element: Element) { + guard let int = storage[element] else { + storage[element] = 1 + return + } + storage[element] = int + 1 + } + + mutating func remove(_ element: Element) -> Int { + guard let int = storage[element] else { return 0 } + if int == 1 { + guard let index = storage.index(forKey: element) else { return 0 } + storage.remove(at: index) + return 0 + } + storage[element] = int - 1 + return storage[element] ?? 0 + } +} +extension CountedSet: ExpressibleByArrayLiteral { + init(arrayLiteral: Element...) { + self.init() + for element in arrayLiteral { + self.insert(element) + } + } +} + + + + + +enum Arrow { case iron, wooden, elven, dwarvish, magic, silver } + var aCountedSet = CountedSet() +aCountedSet[.iron] // 0 +var myCountedSet: CountedSet = [.iron, .magic, .iron, .silver, .iron, .iron] + +myCountedSet[.iron] // 4 +myCountedSet.remove(.iron) // 3 +myCountedSet.remove(.dwarvish) // 0 +myCountedSet.remove(.magic) // + + +enum AppleProducts { case iPhone, iPad, iPod, MacBook, AppleTV } + +var appleCountedSet = CountedSet() + +appleCountedSet[.iPhone] +var myAppleCountedSet: CountedSet = [.iPhone, .iPad, .iPod, .iPhone, .iPad, .iPhone, .AppleTV] +myAppleCountedSet[.iPhone] +myAppleCountedSet.remove(.iPhone) +myAppleCountedSet.remove(.MacBook) +myAppleCountedSet.remove(.iPod) +myAppleCountedSet.remove(.iPhone) diff --git a/Sprint 7/Generics (7.2)/GenericChallenge.playground/contents.xcplayground b/Sprint 7/Generics (7.2)/GenericChallenge.playground/contents.xcplayground new file mode 100644 index 00000000..9f5f2f40 --- /dev/null +++ b/Sprint 7/Generics (7.2)/GenericChallenge.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI.xcodeproj/project.pbxproj b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI.xcodeproj/project.pbxproj new file mode 100644 index 00000000..8a180e5b --- /dev/null +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI.xcodeproj/project.pbxproj @@ -0,0 +1,478 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + A52FC9B42214C2BE0073AF00 /* LoadingUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A52FC9AA2214C2BD0073AF00 /* LoadingUI.framework */; }; + A52FC9B92214C2BE0073AF00 /* LoadingUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52FC9B82214C2BE0073AF00 /* LoadingUITests.swift */; }; + A52FC9BB2214C2BE0073AF00 /* LoadingUI.h in Headers */ = {isa = PBXBuildFile; fileRef = A52FC9AD2214C2BD0073AF00 /* LoadingUI.h */; settings = {ATTRIBUTES = (Public, ); }; }; + A52FCA3D2214D4300073AF00 /* LoadingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52FCA3C2214D4300073AF00 /* LoadingViewController.swift */; }; + A52FCA3F221546AD0073AF00 /* IndeterminateLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52FCA3E221546AD0073AF00 /* IndeterminateLoadingView.swift */; }; + A52FCA41221546B20073AF00 /* PolarPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52FCA40221546B20073AF00 /* PolarPoint.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + A52FC9B52214C2BE0073AF00 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A52FC9A12214C2BD0073AF00 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A52FC9A92214C2BD0073AF00; + remoteInfo = LoadingUI; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + A52FC9AA2214C2BD0073AF00 /* LoadingUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LoadingUI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + A52FC9AD2214C2BD0073AF00 /* LoadingUI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoadingUI.h; sourceTree = ""; }; + A52FC9AE2214C2BD0073AF00 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A52FC9B32214C2BE0073AF00 /* LoadingUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LoadingUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + A52FC9B82214C2BE0073AF00 /* LoadingUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingUITests.swift; sourceTree = ""; }; + A52FC9BA2214C2BE0073AF00 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A52FCA3C2214D4300073AF00 /* LoadingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingViewController.swift; sourceTree = ""; }; + A52FCA3E221546AD0073AF00 /* IndeterminateLoadingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IndeterminateLoadingView.swift; sourceTree = ""; }; + A52FCA40221546B20073AF00 /* PolarPoint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PolarPoint.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A52FC9A72214C2BD0073AF00 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A52FC9B02214C2BE0073AF00 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A52FC9B42214C2BE0073AF00 /* LoadingUI.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A52FC9A02214C2BD0073AF00 = { + isa = PBXGroup; + children = ( + A52FC9AC2214C2BD0073AF00 /* LoadingUI */, + A52FC9B72214C2BE0073AF00 /* LoadingUITests */, + A52FC9AB2214C2BD0073AF00 /* Products */, + ); + sourceTree = ""; + }; + A52FC9AB2214C2BD0073AF00 /* Products */ = { + isa = PBXGroup; + children = ( + A52FC9AA2214C2BD0073AF00 /* LoadingUI.framework */, + A52FC9B32214C2BE0073AF00 /* LoadingUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + A52FC9AC2214C2BD0073AF00 /* LoadingUI */ = { + isa = PBXGroup; + children = ( + A52FC9AD2214C2BD0073AF00 /* LoadingUI.h */, + A52FC9AE2214C2BD0073AF00 /* Info.plist */, + A52FCA3C2214D4300073AF00 /* LoadingViewController.swift */, + A52FCA40221546B20073AF00 /* PolarPoint.swift */, + A52FCA3E221546AD0073AF00 /* IndeterminateLoadingView.swift */, + ); + path = LoadingUI; + sourceTree = ""; + }; + A52FC9B72214C2BE0073AF00 /* LoadingUITests */ = { + isa = PBXGroup; + children = ( + A52FC9B82214C2BE0073AF00 /* LoadingUITests.swift */, + A52FC9BA2214C2BE0073AF00 /* Info.plist */, + ); + path = LoadingUITests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + A52FC9A52214C2BD0073AF00 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + A52FC9BB2214C2BE0073AF00 /* LoadingUI.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + A52FC9A92214C2BD0073AF00 /* LoadingUI */ = { + isa = PBXNativeTarget; + buildConfigurationList = A52FC9BE2214C2BE0073AF00 /* Build configuration list for PBXNativeTarget "LoadingUI" */; + buildPhases = ( + A52FC9A52214C2BD0073AF00 /* Headers */, + A52FC9A62214C2BD0073AF00 /* Sources */, + A52FC9A72214C2BD0073AF00 /* Frameworks */, + A52FC9A82214C2BD0073AF00 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = LoadingUI; + productName = LoadingUI; + productReference = A52FC9AA2214C2BD0073AF00 /* LoadingUI.framework */; + productType = "com.apple.product-type.framework"; + }; + A52FC9B22214C2BE0073AF00 /* LoadingUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = A52FC9C12214C2BE0073AF00 /* Build configuration list for PBXNativeTarget "LoadingUITests" */; + buildPhases = ( + A52FC9AF2214C2BE0073AF00 /* Sources */, + A52FC9B02214C2BE0073AF00 /* Frameworks */, + A52FC9B12214C2BE0073AF00 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + A52FC9B62214C2BE0073AF00 /* PBXTargetDependency */, + ); + name = LoadingUITests; + productName = LoadingUITests; + productReference = A52FC9B32214C2BE0073AF00 /* LoadingUITests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A52FC9A12214C2BD0073AF00 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1010; + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = "Sergey Osipyan"; + TargetAttributes = { + A52FC9A92214C2BD0073AF00 = { + CreatedOnToolsVersion = 10.1; + LastSwiftMigration = 1010; + }; + A52FC9B22214C2BE0073AF00 = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = A52FC9A42214C2BD0073AF00 /* Build configuration list for PBXProject "LoadingUI" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = A52FC9A02214C2BD0073AF00; + productRefGroup = A52FC9AB2214C2BD0073AF00 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + A52FC9A92214C2BD0073AF00 /* LoadingUI */, + A52FC9B22214C2BE0073AF00 /* LoadingUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + A52FC9A82214C2BD0073AF00 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A52FC9B12214C2BE0073AF00 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + A52FC9A62214C2BD0073AF00 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A52FCA41221546B20073AF00 /* PolarPoint.swift in Sources */, + A52FCA3D2214D4300073AF00 /* LoadingViewController.swift in Sources */, + A52FCA3F221546AD0073AF00 /* IndeterminateLoadingView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A52FC9AF2214C2BE0073AF00 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A52FC9B92214C2BE0073AF00 /* LoadingUITests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + A52FC9B62214C2BE0073AF00 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A52FC9A92214C2BD0073AF00 /* LoadingUI */; + targetProxy = A52FC9B52214C2BE0073AF00 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + A52FC9BC2214C2BE0073AF00 /* 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; + CURRENT_PROJECT_VERSION = 1; + 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"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + A52FC9BD2214C2BE0073AF00 /* 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; + CURRENT_PROJECT_VERSION = 1; + 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; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + A52FC9BF2214C2BE0073AF00 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = KF4QEGAU36; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = LoadingUI/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.LoadingUI; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + A52FC9C02214C2BE0073AF00 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = KF4QEGAU36; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = LoadingUI/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.LoadingUI; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + A52FC9C22214C2BE0073AF00 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KF4QEGAU36; + INFOPLIST_FILE = LoadingUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.LoadingUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + A52FC9C32214C2BE0073AF00 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KF4QEGAU36; + INFOPLIST_FILE = LoadingUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.LoadingUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A52FC9A42214C2BD0073AF00 /* Build configuration list for PBXProject "LoadingUI" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A52FC9BC2214C2BE0073AF00 /* Debug */, + A52FC9BD2214C2BE0073AF00 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A52FC9BE2214C2BE0073AF00 /* Build configuration list for PBXNativeTarget "LoadingUI" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A52FC9BF2214C2BE0073AF00 /* Debug */, + A52FC9C02214C2BE0073AF00 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A52FC9C12214C2BE0073AF00 /* Build configuration list for PBXNativeTarget "LoadingUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A52FC9C22214C2BE0073AF00 /* Debug */, + A52FC9C32214C2BE0073AF00 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = A52FC9A12214C2BD0073AF00 /* Project object */; +} diff --git a/Sprint 9/Creating Frameworks/IndeterminateLoadingView.swift b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI/IndeterminateLoadingView.swift similarity index 98% rename from Sprint 9/Creating Frameworks/IndeterminateLoadingView.swift rename to Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI/IndeterminateLoadingView.swift index 18a7145d..39ce0e7c 100644 --- a/Sprint 9/Creating Frameworks/IndeterminateLoadingView.swift +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI/IndeterminateLoadingView.swift @@ -41,7 +41,7 @@ class IndeterminateLoadingView: UIView, CAAnimationDelegate { let thickness: CGFloat = 10.0 shapeLayer.frame = layer.bounds - shapeLayer.strokeColor = UIColor.black.cgColor + shapeLayer.strokeColor = UIColor.gray.cgColor shapeLayer.fillColor = UIColor.clear.cgColor shapeLayer.lineWidth = thickness shapeLayer.strokeStart = 0.0 diff --git a/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI/Info.plist b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI/Info.plist new file mode 100644 index 00000000..e1fe4cfb --- /dev/null +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI/LoadingUI.h b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI/LoadingUI.h new file mode 100644 index 00000000..fb436101 --- /dev/null +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI/LoadingUI.h @@ -0,0 +1,19 @@ +// +// LoadingUI.h +// LoadingUI +// +// Created by Sergey Osipyan on 2/13/19. +// Copyright © 2019 Sergey Osipyan. All rights reserved. +// + +#import + +//! Project version number for LoadingUI. +FOUNDATION_EXPORT double LoadingUIVersionNumber; + +//! Project version string for LoadingUI. +FOUNDATION_EXPORT const unsigned char LoadingUIVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI/LoadingViewController.swift b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI/LoadingViewController.swift new file mode 100644 index 00000000..ca5f1510 --- /dev/null +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI/LoadingViewController.swift @@ -0,0 +1,26 @@ +// +// LoadingViewController.swift +// LoadingUI +// +// Created by Sergey Osipyan on 2/13/19. +// Copyright © 2019 Sergey Osipyan. All rights reserved. +// + +import Foundation + +open class LoadingViewController: UIViewController { + + + var weel = IndeterminateLoadingView() + + override open func viewDidLoad() { + super.viewDidLoad() + + weel = IndeterminateLoadingView(frame: CGRect(x: view.center.x - 50, y: view.center.y - 175, width: 100, height: 100)) + weel.center = view.center + weel.startAnimating() + view.addSubview(weel) + + } + +} diff --git a/Sprint 9/Creating Frameworks/PolarPoint.swift b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI/PolarPoint.swift similarity index 99% rename from Sprint 9/Creating Frameworks/PolarPoint.swift rename to Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI/PolarPoint.swift index 5964e734..b192706b 100644 --- a/Sprint 9/Creating Frameworks/PolarPoint.swift +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUI/PolarPoint.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit struct PolarPoint { diff --git a/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUITests/Info.plist b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUITests/Info.plist new file mode 100644 index 00000000..6c40a6cd --- /dev/null +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUITests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUITests/LoadingUITests.swift b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUITests/LoadingUITests.swift new file mode 100644 index 00000000..76c45257 --- /dev/null +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUI/LoadingUITests/LoadingUITests.swift @@ -0,0 +1,34 @@ +// +// LoadingUITests.swift +// LoadingUITests +// +// Created by Sergey Osipyan on 2/13/19. +// Copyright © 2019 Sergey Osipyan. All rights reserved. +// + +import XCTest +@testable import LoadingUI + +class LoadingUITests: XCTestCase { + + override func setUp() { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest.xcodeproj/project.pbxproj b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest.xcodeproj/project.pbxproj new file mode 100644 index 00000000..39cf8f6f --- /dev/null +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest.xcodeproj/project.pbxproj @@ -0,0 +1,545 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + A52FCA022214C8670073AF00 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52FCA012214C8670073AF00 /* AppDelegate.swift */; }; + A52FCA072214C8670073AF00 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A52FCA052214C8670073AF00 /* Main.storyboard */; }; + A52FCA092214C8680073AF00 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A52FCA082214C8680073AF00 /* Assets.xcassets */; }; + A52FCA0C2214C8680073AF00 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A52FCA0A2214C8680073AF00 /* LaunchScreen.storyboard */; }; + A52FCA172214C8680073AF00 /* LoadingUITestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52FCA162214C8680073AF00 /* LoadingUITestTests.swift */; }; + A52FCA332214C9070073AF00 /* LoadingUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A52FCA302214C8FF0073AF00 /* LoadingUI.framework */; }; + A52FCA342214C9070073AF00 /* LoadingUI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A52FCA302214C8FF0073AF00 /* LoadingUI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + A52FCA132214C8680073AF00 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A52FC9F62214C8670073AF00 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A52FC9FD2214C8670073AF00; + remoteInfo = LoadingUITest; + }; + A52FCA2F2214C8FF0073AF00 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A52FCA2A2214C8FF0073AF00 /* LoadingUI.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = A52FC9AA2214C2BD0073AF00; + remoteInfo = LoadingUI; + }; + A52FCA312214C8FF0073AF00 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A52FCA2A2214C8FF0073AF00 /* LoadingUI.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = A52FC9B32214C2BE0073AF00; + remoteInfo = LoadingUITests; + }; + A52FCA352214C9070073AF00 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A52FCA2A2214C8FF0073AF00 /* LoadingUI.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = A52FC9A92214C2BD0073AF00; + remoteInfo = LoadingUI; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + A52FCA372214C9070073AF00 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + A52FCA342214C9070073AF00 /* LoadingUI.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + A52FC9FE2214C8670073AF00 /* LoadingUITest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LoadingUITest.app; sourceTree = BUILT_PRODUCTS_DIR; }; + A52FCA012214C8670073AF00 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + A52FCA062214C8670073AF00 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + A52FCA082214C8680073AF00 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + A52FCA0B2214C8680073AF00 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + A52FCA0D2214C8680073AF00 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A52FCA122214C8680073AF00 /* LoadingUITestTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LoadingUITestTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + A52FCA162214C8680073AF00 /* LoadingUITestTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingUITestTests.swift; sourceTree = ""; }; + A52FCA182214C8680073AF00 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A52FCA2A2214C8FF0073AF00 /* LoadingUI.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = LoadingUI.xcodeproj; path = ../LoadingUI/LoadingUI.xcodeproj; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A52FC9FB2214C8670073AF00 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A52FCA332214C9070073AF00 /* LoadingUI.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A52FCA0F2214C8680073AF00 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A52FC9F52214C8670073AF00 = { + isa = PBXGroup; + children = ( + A52FCA002214C8670073AF00 /* LoadingUITest */, + A52FCA152214C8680073AF00 /* LoadingUITestTests */, + A52FC9FF2214C8670073AF00 /* Products */, + A52FCA2A2214C8FF0073AF00 /* LoadingUI.xcodeproj */, + ); + sourceTree = ""; + }; + A52FC9FF2214C8670073AF00 /* Products */ = { + isa = PBXGroup; + children = ( + A52FC9FE2214C8670073AF00 /* LoadingUITest.app */, + A52FCA122214C8680073AF00 /* LoadingUITestTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + A52FCA002214C8670073AF00 /* LoadingUITest */ = { + isa = PBXGroup; + children = ( + A52FCA012214C8670073AF00 /* AppDelegate.swift */, + A52FCA052214C8670073AF00 /* Main.storyboard */, + A52FCA082214C8680073AF00 /* Assets.xcassets */, + A52FCA0A2214C8680073AF00 /* LaunchScreen.storyboard */, + A52FCA0D2214C8680073AF00 /* Info.plist */, + ); + path = LoadingUITest; + sourceTree = ""; + }; + A52FCA152214C8680073AF00 /* LoadingUITestTests */ = { + isa = PBXGroup; + children = ( + A52FCA162214C8680073AF00 /* LoadingUITestTests.swift */, + A52FCA182214C8680073AF00 /* Info.plist */, + ); + path = LoadingUITestTests; + sourceTree = ""; + }; + A52FCA2B2214C8FF0073AF00 /* Products */ = { + isa = PBXGroup; + children = ( + A52FCA302214C8FF0073AF00 /* LoadingUI.framework */, + A52FCA322214C8FF0073AF00 /* LoadingUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A52FC9FD2214C8670073AF00 /* LoadingUITest */ = { + isa = PBXNativeTarget; + buildConfigurationList = A52FCA1B2214C8690073AF00 /* Build configuration list for PBXNativeTarget "LoadingUITest" */; + buildPhases = ( + A52FC9FA2214C8670073AF00 /* Sources */, + A52FC9FB2214C8670073AF00 /* Frameworks */, + A52FC9FC2214C8670073AF00 /* Resources */, + A52FCA372214C9070073AF00 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + A52FCA362214C9070073AF00 /* PBXTargetDependency */, + ); + name = LoadingUITest; + productName = LoadingUITest; + productReference = A52FC9FE2214C8670073AF00 /* LoadingUITest.app */; + productType = "com.apple.product-type.application"; + }; + A52FCA112214C8680073AF00 /* LoadingUITestTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = A52FCA1E2214C8690073AF00 /* Build configuration list for PBXNativeTarget "LoadingUITestTests" */; + buildPhases = ( + A52FCA0E2214C8680073AF00 /* Sources */, + A52FCA0F2214C8680073AF00 /* Frameworks */, + A52FCA102214C8680073AF00 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + A52FCA142214C8680073AF00 /* PBXTargetDependency */, + ); + name = LoadingUITestTests; + productName = LoadingUITestTests; + productReference = A52FCA122214C8680073AF00 /* LoadingUITestTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A52FC9F62214C8670073AF00 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1010; + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = "Sergey Osipyan"; + TargetAttributes = { + A52FC9FD2214C8670073AF00 = { + CreatedOnToolsVersion = 10.1; + }; + A52FCA112214C8680073AF00 = { + CreatedOnToolsVersion = 10.1; + TestTargetID = A52FC9FD2214C8670073AF00; + }; + }; + }; + buildConfigurationList = A52FC9F92214C8670073AF00 /* Build configuration list for PBXProject "LoadingUITest" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = A52FC9F52214C8670073AF00; + productRefGroup = A52FC9FF2214C8670073AF00 /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = A52FCA2B2214C8FF0073AF00 /* Products */; + ProjectRef = A52FCA2A2214C8FF0073AF00 /* LoadingUI.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + A52FC9FD2214C8670073AF00 /* LoadingUITest */, + A52FCA112214C8680073AF00 /* LoadingUITestTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + A52FCA302214C8FF0073AF00 /* LoadingUI.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = LoadingUI.framework; + remoteRef = A52FCA2F2214C8FF0073AF00 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + A52FCA322214C8FF0073AF00 /* LoadingUITests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = LoadingUITests.xctest; + remoteRef = A52FCA312214C8FF0073AF00 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + A52FC9FC2214C8670073AF00 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A52FCA0C2214C8680073AF00 /* LaunchScreen.storyboard in Resources */, + A52FCA092214C8680073AF00 /* Assets.xcassets in Resources */, + A52FCA072214C8670073AF00 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A52FCA102214C8680073AF00 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + A52FC9FA2214C8670073AF00 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A52FCA022214C8670073AF00 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A52FCA0E2214C8680073AF00 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A52FCA172214C8680073AF00 /* LoadingUITestTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + A52FCA142214C8680073AF00 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A52FC9FD2214C8670073AF00 /* LoadingUITest */; + targetProxy = A52FCA132214C8680073AF00 /* PBXContainerItemProxy */; + }; + A52FCA362214C9070073AF00 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = LoadingUI; + targetProxy = A52FCA352214C9070073AF00 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + A52FCA052214C8670073AF00 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + A52FCA062214C8670073AF00 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + A52FCA0A2214C8680073AF00 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + A52FCA0B2214C8680073AF00 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + A52FCA192214C8690073AF00 /* 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; + }; + A52FCA1A2214C8690073AF00 /* 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; + }; + A52FCA1C2214C8690073AF00 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KF4QEGAU36; + INFOPLIST_FILE = LoadingUITest/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.LoadingUITest; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + A52FCA1D2214C8690073AF00 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KF4QEGAU36; + INFOPLIST_FILE = LoadingUITest/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.LoadingUITest; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + A52FCA1F2214C8690073AF00 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KF4QEGAU36; + INFOPLIST_FILE = LoadingUITestTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.LoadingUITestTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LoadingUITest.app/LoadingUITest"; + }; + name = Debug; + }; + A52FCA202214C8690073AF00 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KF4QEGAU36; + INFOPLIST_FILE = LoadingUITestTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = Sergey.LoadingUITestTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LoadingUITest.app/LoadingUITest"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A52FC9F92214C8670073AF00 /* Build configuration list for PBXProject "LoadingUITest" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A52FCA192214C8690073AF00 /* Debug */, + A52FCA1A2214C8690073AF00 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A52FCA1B2214C8690073AF00 /* Build configuration list for PBXNativeTarget "LoadingUITest" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A52FCA1C2214C8690073AF00 /* Debug */, + A52FCA1D2214C8690073AF00 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A52FCA1E2214C8690073AF00 /* Build configuration list for PBXNativeTarget "LoadingUITestTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A52FCA1F2214C8690073AF00 /* Debug */, + A52FCA202214C8690073AF00 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = A52FC9F62214C8670073AF00 /* Project object */; +} diff --git a/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/AppDelegate.swift b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/AppDelegate.swift new file mode 100644 index 00000000..024b942a --- /dev/null +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// LoadingUITest +// +// Created by Sergey Osipyan on 2/13/19. +// Copyright © 2019 Sergey Osipyan. 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 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/Assets.xcassets/AppIcon.appiconset/Contents.json b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d8db8d65 --- /dev/null +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/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 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/Assets.xcassets/Contents.json b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/Assets.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/Base.lproj/LaunchScreen.storyboard b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..bfa36129 --- /dev/null +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/Base.lproj/Main.storyboard b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/Base.lproj/Main.storyboard new file mode 100644 index 00000000..15d67d9f --- /dev/null +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/Base.lproj/Main.storyboard @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/Info.plist b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/Info.plist new file mode 100644 index 00000000..16be3b68 --- /dev/null +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/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 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/LoadingUI.gif b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/LoadingUI.gif new file mode 100644 index 00000000..708fa94c Binary files /dev/null and b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITest/LoadingUI.gif differ diff --git a/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITestTests/Info.plist b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITestTests/Info.plist new file mode 100644 index 00000000..6c40a6cd --- /dev/null +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITestTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITestTests/LoadingUITestTests.swift b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITestTests/LoadingUITestTests.swift new file mode 100644 index 00000000..e616a5f1 --- /dev/null +++ b/Sprint 9/Creating Frameworks/LoadingUIFrameworkDevelopment/LoadingUITest/LoadingUITestTests/LoadingUITestTests.swift @@ -0,0 +1,34 @@ +// +// LoadingUITestTests.swift +// LoadingUITestTests +// +// Created by Sergey Osipyan on 2/13/19. +// Copyright © 2019 Sergey Osipyan. All rights reserved. +// + +import XCTest +@testable import LoadingUITest + +class LoadingUITestTests: XCTestCase { + + override func setUp() { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +}