Add Auto Layout constraints for vertical sizing in landscape mode

This commit is contained in:
CypherPoet 2019-01-18 17:51:01 -05:00
parent 72a865b8df
commit 9f38ec59e4
58 changed files with 1091 additions and 0 deletions

View File

@ -0,0 +1,339 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
F3B5E34521EC2CB200D48258 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3B5E34421EC2CB200D48258 /* AppDelegate.swift */; };
F3B5E34721EC2CB200D48258 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3B5E34621EC2CB200D48258 /* ViewController.swift */; };
F3B5E34A21EC2CB200D48258 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F3B5E34821EC2CB200D48258 /* Main.storyboard */; };
F3B5E34C21EC2CB400D48258 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F3B5E34B21EC2CB400D48258 /* Assets.xcassets */; };
F3B5E34F21EC2CB400D48258 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F3B5E34D21EC2CB400D48258 /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
F3B5E34121EC2CB200D48258 /* Guess the Flag.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Guess the Flag.app"; sourceTree = BUILT_PRODUCTS_DIR; };
F3B5E34421EC2CB200D48258 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
F3B5E34621EC2CB200D48258 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
F3B5E34921EC2CB200D48258 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
F3B5E34B21EC2CB400D48258 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
F3B5E34E21EC2CB400D48258 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
F3B5E35021EC2CB400D48258 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
F3B5E33E21EC2CB200D48258 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
F3B5E33821EC2CB200D48258 = {
isa = PBXGroup;
children = (
F3B5E34321EC2CB200D48258 /* Guess the Flag */,
F3B5E34221EC2CB200D48258 /* Products */,
);
sourceTree = "<group>";
};
F3B5E34221EC2CB200D48258 /* Products */ = {
isa = PBXGroup;
children = (
F3B5E34121EC2CB200D48258 /* Guess the Flag.app */,
);
name = Products;
sourceTree = "<group>";
};
F3B5E34321EC2CB200D48258 /* Guess the Flag */ = {
isa = PBXGroup;
children = (
F3B5E34421EC2CB200D48258 /* AppDelegate.swift */,
F3B5E34621EC2CB200D48258 /* ViewController.swift */,
F3B5E34821EC2CB200D48258 /* Main.storyboard */,
F3B5E34B21EC2CB400D48258 /* Assets.xcassets */,
F3B5E34D21EC2CB400D48258 /* LaunchScreen.storyboard */,
F3B5E35021EC2CB400D48258 /* Info.plist */,
);
path = "Guess the Flag";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
F3B5E34021EC2CB200D48258 /* Guess the Flag */ = {
isa = PBXNativeTarget;
buildConfigurationList = F3B5E35321EC2CB400D48258 /* Build configuration list for PBXNativeTarget "Guess the Flag" */;
buildPhases = (
F3B5E33D21EC2CB200D48258 /* Sources */,
F3B5E33E21EC2CB200D48258 /* Frameworks */,
F3B5E33F21EC2CB200D48258 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "Guess the Flag";
productName = "Guess the Flag";
productReference = F3B5E34121EC2CB200D48258 /* Guess the Flag.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
F3B5E33921EC2CB200D48258 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1010;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = "Brian Sipple";
TargetAttributes = {
F3B5E34021EC2CB200D48258 = {
CreatedOnToolsVersion = 10.1;
};
};
};
buildConfigurationList = F3B5E33C21EC2CB200D48258 /* Build configuration list for PBXProject "Guess the Flag" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = F3B5E33821EC2CB200D48258;
productRefGroup = F3B5E34221EC2CB200D48258 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
F3B5E34021EC2CB200D48258 /* Guess the Flag */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
F3B5E33F21EC2CB200D48258 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F3B5E34F21EC2CB400D48258 /* LaunchScreen.storyboard in Resources */,
F3B5E34C21EC2CB400D48258 /* Assets.xcassets in Resources */,
F3B5E34A21EC2CB200D48258 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
F3B5E33D21EC2CB200D48258 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F3B5E34721EC2CB200D48258 /* ViewController.swift in Sources */,
F3B5E34521EC2CB200D48258 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
F3B5E34821EC2CB200D48258 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
F3B5E34921EC2CB200D48258 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
F3B5E34D21EC2CB400D48258 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
F3B5E34E21EC2CB400D48258 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
F3B5E35121EC2CB400D48258 /* 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;
};
F3B5E35221EC2CB400D48258 /* 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;
};
F3B5E35421EC2CB400D48258 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = "Guess the Flag/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "io.sipple.Guess-the-Flag";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
F3B5E35521EC2CB400D48258 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = "Guess the Flag/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "io.sipple.Guess-the-Flag";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
F3B5E33C21EC2CB200D48258 /* Build configuration list for PBXProject "Guess the Flag" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F3B5E35121EC2CB400D48258 /* Debug */,
F3B5E35221EC2CB400D48258 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F3B5E35321EC2CB400D48258 /* Build configuration list for PBXNativeTarget "Guess the Flag" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F3B5E35421EC2CB400D48258 /* Debug */,
F3B5E35521EC2CB400D48258 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = F3B5E33921EC2CB200D48258 /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:Guess the Flag.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,46 @@
//
// AppDelegate.swift
// Guess the Flag
//
// Created by Brian Sipple on 1/13/19.
// Copyright © 2019 Brian Sipple. 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:.
}
}

View File

@ -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"
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "estonia.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "estonia@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "estonia@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "france.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "france@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "france@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "germany.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "germany@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "germany@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "ireland.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ireland@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ireland@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "italy.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "italy@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "italy@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "monaco.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "monaco@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "monaco@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "nigeria.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "nigeria@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "nigeria@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "poland.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "poland@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "poland@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "russia.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "russia@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "russia@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "spain.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "spain@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "spain@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "uk.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "uk@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "uk@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "us.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "us@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "us@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="1Am-tc-ZdC">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="Guess_the_Flag" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vFN-ge-cVu">
<rect key="frame" x="87.5" y="100" width="200" height="100"/>
<color key="backgroundColor" red="0.98754758883248728" green="0.35643531884552954" blue="0.43980186628020179" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<constraints>
<constraint firstAttribute="width" secondItem="vFN-ge-cVu" secondAttribute="height" multiplier="2:1" id="PUf-ad-we6"/>
</constraints>
<state key="normal" image="us">
<color key="titleColor" red="0.45880425499999999" green="0.42457667529999998" blue="0.85103040929999996" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</state>
<connections>
<action selector="buttonTapped:" destination="BYZ-38-t0r" eventType="touchUpInside" id="60c-f8-bO2"/>
</connections>
</button>
<button opaque="NO" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZzW-Kt-38n">
<rect key="frame" x="87.5" y="230" width="200" height="100"/>
<color key="backgroundColor" red="0.98754758880000004" green="0.35643531880000001" blue="0.43980186630000001" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<constraints>
<constraint firstAttribute="width" secondItem="ZzW-Kt-38n" secondAttribute="height" multiplier="2:1" id="3hG-sk-8Hq"/>
</constraints>
<size key="titleShadowOffset" width="2" height="-2"/>
<state key="normal" image="us">
<color key="titleColor" red="0.45880425499999999" green="0.42457667529999998" blue="0.85103040929999996" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</state>
<connections>
<action selector="buttonTapped:" destination="BYZ-38-t0r" eventType="touchUpInside" id="5VZ-Mb-yvZ"/>
</connections>
</button>
<button opaque="NO" tag="2" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NEb-PX-xnZ">
<rect key="frame" x="87.5" y="360" width="200" height="100"/>
<color key="backgroundColor" red="0.98754758880000004" green="0.35643531880000001" blue="0.43980186630000001" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<constraints>
<constraint firstAttribute="width" secondItem="NEb-PX-xnZ" secondAttribute="height" multiplier="2:1" id="DRz-Cg-sf3"/>
</constraints>
<state key="normal" image="us">
<color key="titleColor" red="0.45880425499999999" green="0.42457667529999998" blue="0.85103040929999996" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</state>
<connections>
<action selector="buttonTapped:" destination="BYZ-38-t0r" eventType="touchUpInside" id="U4R-CP-ARt"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Current Score" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4XS-g3-zAP">
<rect key="frame" x="105" y="483" width="164" height="29"/>
<fontDescription key="fontDescription" type="system" weight="heavy" pointSize="24"/>
<color key="textColor" red="0.36238711552087849" green="0.35869689454197995" blue="0.36653315355329952" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="NEb-PX-xnZ" firstAttribute="centerX" secondItem="ZzW-Kt-38n" secondAttribute="centerX" id="9DD-6n-qia"/>
<constraint firstItem="vFN-ge-cVu" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="Ana-r5-8X4"/>
<constraint firstItem="4XS-g3-zAP" firstAttribute="top" secondItem="NEb-PX-xnZ" secondAttribute="bottom" constant="42" id="Cez-BE-16U"/>
<constraint firstItem="4XS-g3-zAP" firstAttribute="centerX" secondItem="NEb-PX-xnZ" secondAttribute="centerX" id="T8Y-IP-64X"/>
<constraint firstItem="ZzW-Kt-38n" firstAttribute="height" secondItem="vFN-ge-cVu" secondAttribute="height" id="Tp2-Fn-oIN"/>
<constraint firstItem="NEb-PX-xnZ" firstAttribute="height" secondItem="ZzW-Kt-38n" secondAttribute="height" id="hGh-cc-HOr"/>
<constraint firstItem="ZzW-Kt-38n" firstAttribute="centerX" secondItem="vFN-ge-cVu" secondAttribute="centerX" id="lWQ-jf-5mz"/>
<constraint firstItem="vFN-ge-cVu" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="36" id="mvu-kE-JYZ"/>
<constraint firstItem="ZzW-Kt-38n" firstAttribute="top" secondItem="vFN-ge-cVu" secondAttribute="bottom" constant="30" id="qvO-bf-ZhS"/>
<constraint firstItem="NEb-PX-xnZ" firstAttribute="top" secondItem="ZzW-Kt-38n" secondAttribute="bottom" constant="30" id="r33-xu-Qvt"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="4XS-g3-zAP" secondAttribute="bottom" constant="20" id="vTZ-Tu-vF8"/>
</constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
<navigationItem key="navigationItem" id="UDi-mp-oYB"/>
<connections>
<outlet property="button1" destination="vFN-ge-cVu" id="tFe-hn-j0d"/>
<outlet property="button2" destination="ZzW-Kt-38n" id="gbi-UL-J0u"/>
<outlet property="button3" destination="NEb-PX-xnZ" id="FBe-Yt-iKY"/>
<outlet property="scoreLabel" destination="4XS-g3-zAP" id="vVY-uo-ddQ"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="998" y="-564"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="RBc-hJ-bM1">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="1Am-tc-ZdC" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="FpY-a1-CVA">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="Eoo-tD-F4A"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="pEB-Ha-oSF" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="132" y="-564.46776611694156"/>
</scene>
</scenes>
<resources>
<image name="us" width="200" height="100"/>
</resources>
</document>

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Guess the Flag 2</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@ -0,0 +1,121 @@
//
// ViewController.swift
// Guess the Flag
//
// Created by Brian Sipple on 1/13/19.
// Copyright © 2019 Brian Sipple. All rights reserved.
//
import UIKit
let flagFilePathsAndNames = [
"estonia": "Estonia",
"france": "France",
"germany": "Germany",
"ireland": "Ireland",
"italy": "Italy",
"monaco": "Monaco",
"nigeria": "Nigeria",
"poland": "Poland",
"russia": "Russia",
"spain": "Spain",
"uk": "United Kingdom",
"us": "United States",
]
class ViewController: UIViewController {
@IBOutlet var button1: UIButton!
@IBOutlet var button2: UIButton!
@IBOutlet var button3: UIButton!
@IBOutlet var scoreLabel: UILabel!
var currentScore = 0 {
didSet {
scoreLabel.text = "Current Score: \(self.currentScore)"
}
}
var flagChoiceKeys = [String]()
var correctFlagKey: String?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
currentScore = 0
setupButtonStyles()
askQuestion()
}
func askQuestion() {
flagChoiceKeys = Array(flagFilePathsAndNames.keys.shuffled()[..<3])
correctFlagKey = flagChoiceKeys.randomElement()
if let _key = correctFlagKey {
if let flagName = flagFilePathsAndNames[_key] {
// 📝 If we didn't get here, that would be a serious problem that needed more robust error handling
title = "Which flag belongs to \(flagName)?"
}
}
for (index, button) in [button1, button2, button3].enumerated() {
button?.setImage(UIImage(named: flagChoiceKeys[index]), for: .normal)
}
}
func setupButtonStyles() {
for button in [button1, button2, button3] {
button?.layer.shadowRadius = 3.0
button?.layer.shadowOffset = CGSize(width: 0.0, height: 0.0);
button?.layer.shadowOpacity = 1.0
button?.layer.shadowColor = UIColor(red:0.13, green:0.14, blue:0.21, alpha:1.00).cgColor
}
}
func handleChoice(wasCorrect: Bool) {
var responseMessage: String
if wasCorrect {
title = "Correct!"
responseMessage = "You just gained 1 point."
currentScore += 1
} else {
title = "Incorrect!"
responseMessage = "You just lost 3 points"
currentScore = max(0, currentScore - 3)
}
let alertController = UIAlertController(title: title, message: responseMessage, preferredStyle: .alert)
alertController.addAction(
UIAlertAction(title: "Continue", style: .default, handler: _askAnotherQuestion)
)
present(alertController, animated: true)
}
@IBAction func buttonTapped(_ sender: UIButton) {
let flagKeyChosen = flagChoiceKeys[sender.tag]
if flagKeyChosen == correctFlagKey {
handleChoice(wasCorrect: true)
} else {
handleChoice(wasCorrect: false)
}
}
/// callback for the UIAlertAction that conforms to the signature it expects
/// (that is, taking a UIAlertAction argument).
///
/// All we really want to do, though, is ask another quesstion, so this function
/// just hides the handler implementation detail away from `askQuestion`
func _askAnotherQuestion(action: UIAlertAction) {
askQuestion()
}
}