From 09bec6dd8d2532da258163c29693f0188db0e7fd Mon Sep 17 00:00:00 2001 From: Kevin McGill Date: Sat, 10 Jun 2017 19:49:57 -0500 Subject: [PATCH 01/15] Add licenses to all swift files. Add git ignore. Experimenting with popover. --- .gitignore | 1 + Example/McPicker.xcodeproj/project.pbxproj | 4 +-- Example/McPicker/AppDelegate.swift | 20 ++++++++--- Example/McPicker/Base.lproj/Main.storyboard | 16 ++++++--- Example/McPicker/ViewController.swift | 38 ++++++++++++++++----- Example/Podfile.lock | 6 ++-- McPicker/Classes/McPicker.swift | 21 +++++++++--- 7 files changed, 81 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index e7b722d..56e1505 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ Carthage # `pod install` in .travis.yml # # Pods/ +Example/Pods diff --git a/Example/McPicker.xcodeproj/project.pbxproj b/Example/McPicker.xcodeproj/project.pbxproj index 1a0890e..0129afa 100644 --- a/Example/McPicker.xcodeproj/project.pbxproj +++ b/Example/McPicker.xcodeproj/project.pbxproj @@ -291,7 +291,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; 973D169A1B9454CE644A8880 /* [CP] Copy Pods Resources */ = { @@ -351,7 +351,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/Example/McPicker/AppDelegate.swift b/Example/McPicker/AppDelegate.swift index d37d67a..eba25b6 100644 --- a/Example/McPicker/AppDelegate.swift +++ b/Example/McPicker/AppDelegate.swift @@ -1,10 +1,22 @@ +//Copyright (c) 2017 Kevin McGill // -// AppDelegate.swift -// McPicker +//Permission is hereby granted, free of charge, to any person obtaining a copy +//of this software and associated documentation files (the "Software"), to deal +//in the Software without restriction, including without limitation the rights +//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +//copies of the Software, and to permit persons to whom the Software is +//furnished to do so, subject to the following conditions: // -// Created by Kevin McGill on 03/22/2017. -// Copyright (c) 2017 Kevin McGill. All rights reserved. +//The above copyright notice and this permission notice shall be included in +//all copies or substantial portions of the Software. // +//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +//THE SOFTWARE. import UIKit diff --git a/Example/McPicker/Base.lproj/Main.storyboard b/Example/McPicker/Base.lproj/Main.storyboard index e616d72..1ec5222 100644 --- a/Example/McPicker/Base.lproj/Main.storyboard +++ b/Example/McPicker/Base.lproj/Main.storyboard @@ -1,11 +1,11 @@ - + - + @@ -37,17 +37,25 @@ + + + - diff --git a/Example/McPicker/ViewController.swift b/Example/McPicker/ViewController.swift index fc78294..2bb6cec 100644 --- a/Example/McPicker/ViewController.swift +++ b/Example/McPicker/ViewController.swift @@ -1,10 +1,22 @@ +//Copyright (c) 2017 Kevin McGill // -// ViewController.swift -// McPicker +//Permission is hereby granted, free of charge, to any person obtaining a copy +//of this software and associated documentation files (the "Software"), to deal +//in the Software without restriction, including without limitation the rights +//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +//copies of the Software, and to permit persons to whom the Software is +//furnished to do so, subject to the following conditions: // -// Created by Kevin McGill on 03/22/2017. -// Copyright (c) 2017 Kevin McGill. All rights reserved. +//The above copyright notice and this permission notice shall be included in +//all copies or substantial portions of the Software. // +//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +//THE SOFTWARE. import UIKit import McPicker @@ -45,13 +57,13 @@ class ViewController: UIViewController { // Short hand // - McPicker.show(data: [["Kevin", "Lauren", "Kibby", "Stella"]], doneHandler: { selections in + McPicker.show(data: [["Kevin", "Lauren", "Kibby", "Stella"]]) { selections in // Selection(s) Made // if let name = selections[0] { self.label.text = name } - }) + } } @IBAction func styledPicker(_ sender: Any) { @@ -73,11 +85,21 @@ class ViewController: UIViewController { picker.toolbarBarTintColor = .darkGray picker.pickerBackgroundColor = .gray - picker.show(doneHandler: { selections in + picker.show() { selections in if let prefix = selections[0], let name = selections[1] { self.label.text = "\(prefix) \(name)" } - }) + } } + + @IBAction func popOverPicker(_ sender: Any) { + + + + + + } + + } diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 420126b..9405be2 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - McPicker (0.1.0) + - McPicker (0.2.0) DEPENDENCIES: - McPicker (from `../`) @@ -9,8 +9,8 @@ EXTERNAL SOURCES: :path: ../ SPEC CHECKSUMS: - McPicker: 2ced96570c19ec1d34b97288eed72ad558900257 + McPicker: 2f20656e57cc2c6557ad67215af9e0ad3da969d2 PODFILE CHECKSUM: df27bacc289d117609fa33791b354401fb37cd9e -COCOAPODS: 1.1.1 +COCOAPODS: 1.2.1 diff --git a/McPicker/Classes/McPicker.swift b/McPicker/Classes/McPicker.swift index 383ee13..2770918 100644 --- a/McPicker/Classes/McPicker.swift +++ b/McPicker/Classes/McPicker.swift @@ -1,10 +1,23 @@ +//Copyright (c) 2017 Kevin McGill // -// McPicker.swift -// Pods -// -// Created by Kevin McGill on 3/22/17. +//Permission is hereby granted, free of charge, to any person obtaining a copy +//of this software and associated documentation files (the "Software"), to deal +//in the Software without restriction, including without limitation the rights +//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +//copies of the Software, and to permit persons to whom the Software is +//furnished to do so, subject to the following conditions: // +//The above copyright notice and this permission notice shall be included in +//all copies or substantial portions of the Software. // +//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +//THE SOFTWARE. + import UIKit From b62476be8cc6ec8b7fa7d6ddc7d55e652cef4b8d Mon Sep 17 00:00:00 2001 From: Kevin McGill Date: Sun, 11 Jun 2017 09:59:23 -0500 Subject: [PATCH 02/15] Experimenting with Popovers. --- .travis.yml | 6 +-- Example/McPicker.xcodeproj/project.pbxproj | 2 + Example/McPicker/Base.lproj/Main.storyboard | 6 ++- Example/McPicker/ViewController.swift | 25 ++++++++---- McPicker/Classes/McPicker.swift | 44 ++++++++++----------- 5 files changed, 48 insertions(+), 35 deletions(-) diff --git a/.travis.yml b/.travis.yml index 54d3eff..1f9da66 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,13 +2,13 @@ # * http://www.objc.io/issue-6/travis-ci.html # * https://github.com/supermarin/xcpretty#usage -osx_image: xcode7.3 -language: objective-c +osx_image: xcode8.3 +language: swift # cache: cocoapods # podfile: Example/Podfile # before_install: # - gem install cocoapods # Since Travis is not always on latest version # - pod install --project-directory=Example script: -- set -o pipefail && xcodebuild test -workspace Example/McPicker.xcworkspace -scheme McPicker-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty +- set -o pipefail && xcodebuild test -workspace Example/McPicker.xcworkspace -scheme McPicker-Example -destination 'platform=iOS Simulator,name=iPhone 7 Plus,OS=10.3.1' ONLY_ACTIVE_ARCH=NO | xcpretty - pod lib lint diff --git a/Example/McPicker.xcodeproj/project.pbxproj b/Example/McPicker.xcodeproj/project.pbxproj index 0129afa..c46b55b 100644 --- a/Example/McPicker.xcodeproj/project.pbxproj +++ b/Example/McPicker.xcodeproj/project.pbxproj @@ -504,6 +504,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 3.0; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; @@ -520,6 +521,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 3.0; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; diff --git a/Example/McPicker/Base.lproj/Main.storyboard b/Example/McPicker/Base.lproj/Main.storyboard index 1ec5222..cf37237 100644 --- a/Example/McPicker/Base.lproj/Main.storyboard +++ b/Example/McPicker/Base.lproj/Main.storyboard @@ -42,8 +42,8 @@ -