From 28dcf425acf433a09625e5f4a6c089d8f35cd62d Mon Sep 17 00:00:00 2001 From: OmegaWulf Date: Thu, 11 Oct 2018 15:21:44 -0400 Subject: [PATCH 1/4] Initial Commit --- .../JSONEncoding.xcodeproj/project.pbxproj | 341 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + JSONEncoding/JSONEncoding/AppDelegate.swift | 46 +++ .../AppIcon.appiconset/Contents.json | 98 +++++ .../Assets.xcassets/Contents.json | 6 + .../Base.lproj/LaunchScreen.storyboard | 25 ++ .../JSONEncoding/Base.lproj/Main.storyboard | 24 ++ JSONEncoding/JSONEncoding/Info.plist | 45 +++ .../JSONEncoding/ViewController.swift | 20 + 10 files changed, 620 insertions(+) create mode 100644 JSONEncoding/JSONEncoding.xcodeproj/project.pbxproj create mode 100644 JSONEncoding/JSONEncoding.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 JSONEncoding/JSONEncoding.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 JSONEncoding/JSONEncoding/AppDelegate.swift create mode 100644 JSONEncoding/JSONEncoding/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 JSONEncoding/JSONEncoding/Assets.xcassets/Contents.json create mode 100644 JSONEncoding/JSONEncoding/Base.lproj/LaunchScreen.storyboard create mode 100644 JSONEncoding/JSONEncoding/Base.lproj/Main.storyboard create mode 100644 JSONEncoding/JSONEncoding/Info.plist create mode 100644 JSONEncoding/JSONEncoding/ViewController.swift diff --git a/JSONEncoding/JSONEncoding.xcodeproj/project.pbxproj b/JSONEncoding/JSONEncoding.xcodeproj/project.pbxproj new file mode 100644 index 0000000..8a3a642 --- /dev/null +++ b/JSONEncoding/JSONEncoding.xcodeproj/project.pbxproj @@ -0,0 +1,341 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 1162AF3F216FDA2B00A984DA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1162AF3E216FDA2B00A984DA /* AppDelegate.swift */; }; + 1162AF41216FDA2B00A984DA /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1162AF40216FDA2B00A984DA /* ViewController.swift */; }; + 1162AF44216FDA2B00A984DA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1162AF42216FDA2B00A984DA /* Main.storyboard */; }; + 1162AF46216FDA2C00A984DA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1162AF45216FDA2C00A984DA /* Assets.xcassets */; }; + 1162AF49216FDA2C00A984DA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1162AF47216FDA2C00A984DA /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 1162AF3B216FDA2B00A984DA /* JSONEncoding.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JSONEncoding.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1162AF3E216FDA2B00A984DA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 1162AF40216FDA2B00A984DA /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 1162AF43216FDA2B00A984DA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 1162AF45216FDA2C00A984DA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 1162AF48216FDA2C00A984DA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 1162AF4A216FDA2C00A984DA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1162AF38216FDA2B00A984DA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1162AF32216FDA2B00A984DA = { + isa = PBXGroup; + children = ( + 1162AF3D216FDA2B00A984DA /* JSONEncoding */, + 1162AF3C216FDA2B00A984DA /* Products */, + ); + sourceTree = ""; + }; + 1162AF3C216FDA2B00A984DA /* Products */ = { + isa = PBXGroup; + children = ( + 1162AF3B216FDA2B00A984DA /* JSONEncoding.app */, + ); + name = Products; + sourceTree = ""; + }; + 1162AF3D216FDA2B00A984DA /* JSONEncoding */ = { + isa = PBXGroup; + children = ( + 1162AF3E216FDA2B00A984DA /* AppDelegate.swift */, + 1162AF40216FDA2B00A984DA /* ViewController.swift */, + 1162AF42216FDA2B00A984DA /* Main.storyboard */, + 1162AF45216FDA2C00A984DA /* Assets.xcassets */, + 1162AF47216FDA2C00A984DA /* LaunchScreen.storyboard */, + 1162AF4A216FDA2C00A984DA /* Info.plist */, + ); + path = JSONEncoding; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1162AF3A216FDA2B00A984DA /* JSONEncoding */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1162AF4D216FDA2C00A984DA /* Build configuration list for PBXNativeTarget "JSONEncoding" */; + buildPhases = ( + 1162AF37216FDA2B00A984DA /* Sources */, + 1162AF38216FDA2B00A984DA /* Frameworks */, + 1162AF39216FDA2B00A984DA /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = JSONEncoding; + productName = JSONEncoding; + productReference = 1162AF3B216FDA2B00A984DA /* JSONEncoding.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 1162AF33216FDA2B00A984DA /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1000; + LastUpgradeCheck = 1000; + ORGANIZATIONNAME = "Nikita Thomas"; + TargetAttributes = { + 1162AF3A216FDA2B00A984DA = { + CreatedOnToolsVersion = 10.0; + }; + }; + }; + buildConfigurationList = 1162AF36216FDA2B00A984DA /* Build configuration list for PBXProject "JSONEncoding" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 1162AF32216FDA2B00A984DA; + productRefGroup = 1162AF3C216FDA2B00A984DA /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1162AF3A216FDA2B00A984DA /* JSONEncoding */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 1162AF39216FDA2B00A984DA /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1162AF49216FDA2C00A984DA /* LaunchScreen.storyboard in Resources */, + 1162AF46216FDA2C00A984DA /* Assets.xcassets in Resources */, + 1162AF44216FDA2B00A984DA /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1162AF37216FDA2B00A984DA /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1162AF41216FDA2B00A984DA /* ViewController.swift in Sources */, + 1162AF3F216FDA2B00A984DA /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 1162AF42216FDA2B00A984DA /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 1162AF43216FDA2B00A984DA /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 1162AF47216FDA2C00A984DA /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 1162AF48216FDA2C00A984DA /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 1162AF4B216FDA2C00A984DA /* 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.0; + 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; + }; + 1162AF4C216FDA2C00A984DA /* 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.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 1162AF4E216FDA2C00A984DA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = FXUY9QKNNU; + INFOPLIST_FILE = JSONEncoding/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.NikitaThomas.JSONEncoding; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 1162AF4F216FDA2C00A984DA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = FXUY9QKNNU; + INFOPLIST_FILE = JSONEncoding/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.NikitaThomas.JSONEncoding; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1162AF36216FDA2B00A984DA /* Build configuration list for PBXProject "JSONEncoding" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1162AF4B216FDA2C00A984DA /* Debug */, + 1162AF4C216FDA2C00A984DA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1162AF4D216FDA2C00A984DA /* Build configuration list for PBXNativeTarget "JSONEncoding" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1162AF4E216FDA2C00A984DA /* Debug */, + 1162AF4F216FDA2C00A984DA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 1162AF33216FDA2B00A984DA /* Project object */; +} diff --git a/JSONEncoding/JSONEncoding.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/JSONEncoding/JSONEncoding.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..9fbc0c8 --- /dev/null +++ b/JSONEncoding/JSONEncoding.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/JSONEncoding/JSONEncoding.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/JSONEncoding/JSONEncoding.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/JSONEncoding/JSONEncoding.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/JSONEncoding/JSONEncoding/AppDelegate.swift b/JSONEncoding/JSONEncoding/AppDelegate.swift new file mode 100644 index 0000000..be7da3a --- /dev/null +++ b/JSONEncoding/JSONEncoding/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// JSONEncoding +// +// Created by Nikita Thomas on 10/11/18. +// Copyright © 2018 Nikita Thomas. 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/JSONEncoding/JSONEncoding/Assets.xcassets/AppIcon.appiconset/Contents.json b/JSONEncoding/JSONEncoding/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d8db8d6 --- /dev/null +++ b/JSONEncoding/JSONEncoding/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/JSONEncoding/JSONEncoding/Assets.xcassets/Contents.json b/JSONEncoding/JSONEncoding/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/JSONEncoding/JSONEncoding/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/JSONEncoding/JSONEncoding/Base.lproj/LaunchScreen.storyboard b/JSONEncoding/JSONEncoding/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..bfa3612 --- /dev/null +++ b/JSONEncoding/JSONEncoding/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/JSONEncoding/JSONEncoding/Base.lproj/Main.storyboard b/JSONEncoding/JSONEncoding/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f1bcf38 --- /dev/null +++ b/JSONEncoding/JSONEncoding/Base.lproj/Main.storyboard @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/JSONEncoding/JSONEncoding/Info.plist b/JSONEncoding/JSONEncoding/Info.plist new file mode 100644 index 0000000..16be3b6 --- /dev/null +++ b/JSONEncoding/JSONEncoding/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/JSONEncoding/JSONEncoding/ViewController.swift b/JSONEncoding/JSONEncoding/ViewController.swift new file mode 100644 index 0000000..a8afb05 --- /dev/null +++ b/JSONEncoding/JSONEncoding/ViewController.swift @@ -0,0 +1,20 @@ +// +// ViewController.swift +// JSONEncoding +// +// Created by Nikita Thomas on 10/11/18. +// Copyright © 2018 Nikita Thomas. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + } + + +} + From f0bb06253093e3ab58d815976a4cb2fbe6aeb3f2 Mon Sep 17 00:00:00 2001 From: OmegaWulf Date: Thu, 11 Oct 2018 15:24:07 -0400 Subject: [PATCH 2/4] Created Student Struct --- .../JSONEncoding.xcodeproj/project.pbxproj | 4 ++++ JSONEncoding/JSONEncoding/Student.swift | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 JSONEncoding/JSONEncoding/Student.swift diff --git a/JSONEncoding/JSONEncoding.xcodeproj/project.pbxproj b/JSONEncoding/JSONEncoding.xcodeproj/project.pbxproj index 8a3a642..11b4970 100644 --- a/JSONEncoding/JSONEncoding.xcodeproj/project.pbxproj +++ b/JSONEncoding/JSONEncoding.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ 1162AF44216FDA2B00A984DA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1162AF42216FDA2B00A984DA /* Main.storyboard */; }; 1162AF46216FDA2C00A984DA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1162AF45216FDA2C00A984DA /* Assets.xcassets */; }; 1162AF49216FDA2C00A984DA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1162AF47216FDA2C00A984DA /* LaunchScreen.storyboard */; }; + 1162AF51216FDA5700A984DA /* Student.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1162AF50216FDA5700A984DA /* Student.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -22,6 +23,7 @@ 1162AF45216FDA2C00A984DA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 1162AF48216FDA2C00A984DA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 1162AF4A216FDA2C00A984DA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 1162AF50216FDA5700A984DA /* Student.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Student.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -54,6 +56,7 @@ 1162AF3D216FDA2B00A984DA /* JSONEncoding */ = { isa = PBXGroup; children = ( + 1162AF50216FDA5700A984DA /* Student.swift */, 1162AF3E216FDA2B00A984DA /* AppDelegate.swift */, 1162AF40216FDA2B00A984DA /* ViewController.swift */, 1162AF42216FDA2B00A984DA /* Main.storyboard */, @@ -136,6 +139,7 @@ buildActionMask = 2147483647; files = ( 1162AF41216FDA2B00A984DA /* ViewController.swift in Sources */, + 1162AF51216FDA5700A984DA /* Student.swift in Sources */, 1162AF3F216FDA2B00A984DA /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/JSONEncoding/JSONEncoding/Student.swift b/JSONEncoding/JSONEncoding/Student.swift new file mode 100644 index 0000000..e7e6c38 --- /dev/null +++ b/JSONEncoding/JSONEncoding/Student.swift @@ -0,0 +1,20 @@ +// +// Student.swift +// JSONEncoding +// +// Created by Nikita Thomas on 10/11/18. +// Copyright © 2018 Nikita Thomas. All rights reserved. +// + +import Foundation + +struct Student: CustomStringConvertible, Codable { + var description: String { + let result = "" + return result + } + + let name: String + let age: Int? + let cohort: String? +} From 85ec7fc076c346a6928675f0e3fcca21d1062d68 Mon Sep 17 00:00:00 2001 From: OmegaWulf Date: Thu, 11 Oct 2018 15:47:34 -0400 Subject: [PATCH 3/4] Finished Student Manager --- .../JSONEncoding.xcodeproj/project.pbxproj | 4 ++ .../JSONEncoding/Base.lproj/Main.storyboard | 59 ++++++++++++++++++- .../JSONEncoding/StudentManager.swift | 37 ++++++++++++ 3 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 JSONEncoding/JSONEncoding/StudentManager.swift diff --git a/JSONEncoding/JSONEncoding.xcodeproj/project.pbxproj b/JSONEncoding/JSONEncoding.xcodeproj/project.pbxproj index 11b4970..874450a 100644 --- a/JSONEncoding/JSONEncoding.xcodeproj/project.pbxproj +++ b/JSONEncoding/JSONEncoding.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 1162AF46216FDA2C00A984DA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1162AF45216FDA2C00A984DA /* Assets.xcassets */; }; 1162AF49216FDA2C00A984DA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1162AF47216FDA2C00A984DA /* LaunchScreen.storyboard */; }; 1162AF51216FDA5700A984DA /* Student.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1162AF50216FDA5700A984DA /* Student.swift */; }; + 1162AF53216FDAE500A984DA /* StudentManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1162AF52216FDAE500A984DA /* StudentManager.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -24,6 +25,7 @@ 1162AF48216FDA2C00A984DA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 1162AF4A216FDA2C00A984DA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 1162AF50216FDA5700A984DA /* Student.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Student.swift; sourceTree = ""; }; + 1162AF52216FDAE500A984DA /* StudentManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StudentManager.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -56,6 +58,7 @@ 1162AF3D216FDA2B00A984DA /* JSONEncoding */ = { isa = PBXGroup; children = ( + 1162AF52216FDAE500A984DA /* StudentManager.swift */, 1162AF50216FDA5700A984DA /* Student.swift */, 1162AF3E216FDA2B00A984DA /* AppDelegate.swift */, 1162AF40216FDA2B00A984DA /* ViewController.swift */, @@ -139,6 +142,7 @@ buildActionMask = 2147483647; files = ( 1162AF41216FDA2B00A984DA /* ViewController.swift in Sources */, + 1162AF53216FDAE500A984DA /* StudentManager.swift in Sources */, 1162AF51216FDA5700A984DA /* Student.swift in Sources */, 1162AF3F216FDA2B00A984DA /* AppDelegate.swift in Sources */, ); diff --git a/JSONEncoding/JSONEncoding/Base.lproj/Main.storyboard b/JSONEncoding/JSONEncoding/Base.lproj/Main.storyboard index f1bcf38..a0d6478 100644 --- a/JSONEncoding/JSONEncoding/Base.lproj/Main.storyboard +++ b/JSONEncoding/JSONEncoding/Base.lproj/Main.storyboard @@ -1,7 +1,10 @@ - + + + + - + @@ -9,15 +12,65 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/JSONEncoding/JSONEncoding/StudentManager.swift b/JSONEncoding/JSONEncoding/StudentManager.swift new file mode 100644 index 0000000..d810e45 --- /dev/null +++ b/JSONEncoding/JSONEncoding/StudentManager.swift @@ -0,0 +1,37 @@ +// +// StudentManager.swift +// JSONEncoding +// +// Created by Nikita Thomas on 10/11/18. +// Copyright © 2018 Nikita Thomas. All rights reserved. +// + +import Foundation + +class StudentManager: NSObject { + var students: [Student] = [] + + let url = URL(fileURLWithPath: NSHomeDirectory()) + .appendingPathComponent("Documents") + .appendingPathComponent("students.json") + + func writeToFile() { + do { + let studentsEncoded = try JSONEncoder().encode(students) + try studentsEncoded.write(to: url) + + } catch { + print("Error: \(error)") + } + } + + func readFromFile() { + do { + let data = try Data(contentsOf: url) + let studentsDecoded = try JSONDecoder().decode([Student].self, from: data) + students = studentsDecoded + } catch { + print("Error: \(error)") + } + } +} From f7dd9d75f2c0288fd84471fdf3aa7ac766e7592b Mon Sep 17 00:00:00 2001 From: OmegaWulf Date: Thu, 11 Oct 2018 16:30:31 -0400 Subject: [PATCH 4/4] Implemented saveToFile and clear button --- .../JSONEncoding/Base.lproj/Main.storyboard | 24 ++++++++++++++ JSONEncoding/JSONEncoding/Student.swift | 8 ++++- .../JSONEncoding/StudentManager.swift | 5 +++ .../JSONEncoding/ViewController.swift | 33 ++++++++++++++++--- 4 files changed, 64 insertions(+), 6 deletions(-) diff --git a/JSONEncoding/JSONEncoding/Base.lproj/Main.storyboard b/JSONEncoding/JSONEncoding/Base.lproj/Main.storyboard index a0d6478..3518a65 100644 --- a/JSONEncoding/JSONEncoding/Base.lproj/Main.storyboard +++ b/JSONEncoding/JSONEncoding/Base.lproj/Main.storyboard @@ -63,11 +63,35 @@ + + + + + + + + + + + diff --git a/JSONEncoding/JSONEncoding/Student.swift b/JSONEncoding/JSONEncoding/Student.swift index e7e6c38..ec51651 100644 --- a/JSONEncoding/JSONEncoding/Student.swift +++ b/JSONEncoding/JSONEncoding/Student.swift @@ -10,7 +10,13 @@ import Foundation struct Student: CustomStringConvertible, Codable { var description: String { - let result = "" + var result = "Name: \(name)" + if let age = age { + result += ", Age: \(age)" + } + if let cohort = cohort { + result += ", Cohort: \(cohort)." + } return result } diff --git a/JSONEncoding/JSONEncoding/StudentManager.swift b/JSONEncoding/JSONEncoding/StudentManager.swift index d810e45..1a752d5 100644 --- a/JSONEncoding/JSONEncoding/StudentManager.swift +++ b/JSONEncoding/JSONEncoding/StudentManager.swift @@ -34,4 +34,9 @@ class StudentManager: NSObject { print("Error: \(error)") } } + + func create(name: String, age: Int?, cohort: String?) { + let student = Student.init(name: name, age: age, cohort: cohort) + students.append(student) + } } diff --git a/JSONEncoding/JSONEncoding/ViewController.swift b/JSONEncoding/JSONEncoding/ViewController.swift index a8afb05..29d6352 100644 --- a/JSONEncoding/JSONEncoding/ViewController.swift +++ b/JSONEncoding/JSONEncoding/ViewController.swift @@ -10,11 +10,34 @@ import UIKit class ViewController: UIViewController { - override func viewDidLoad() { - super.viewDidLoad() - // Do any additional setup after loading the view, typically from a nib. + @IBOutlet weak var nameText: UITextField! + @IBOutlet weak var ageText: UITextField! + @IBOutlet weak var cohortText: UITextField! + let studentManager = StudentManager() + + @IBAction func saveButton(_ sender: Any) { + guard let name = nameText.text else {return} + guard let age = ageText.text else {return} + guard let cohort = cohortText.text else {return} + studentManager.create(name: name, age: Int(age), cohort: cohort) + studentManager.writeToFile() } - - + + @IBAction func printButton(_ sender: Any) { + print(studentManager.students) + + } + + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + studentManager.readFromFile() + } + + @IBAction func deleteButton(_ sender: Any) { + studentManager.students = [] + studentManager.writeToFile() + } + }