Skip to content

Commit

Permalink
Updated to swift 4.0
Browse files Browse the repository at this point in the history
Added AppIcon to example
Switched pattern for example to Indian
Fixed ios 11 bug.
  • Loading branch information
NikKovIos committed Oct 17, 2017
1 parent f6f6eb0 commit 0b57ef1
Show file tree
Hide file tree
Showing 27 changed files with 137 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0
4.0
60 changes: 44 additions & 16 deletions Example/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,89 +1,117 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"idiom" : "iphone",
"filename" : "LogoiPhoneNotification_20pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"idiom" : "iphone",
"filename" : "LogoiPhoneNotification_20pt@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "LogoiPhoneSpootlight5_29pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "LogoiPhoneSpootlight5_29pt@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "LogoiPhoneSpootlight7_40pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "LogoiPhoneSpootlight7_40pt@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "LogoiPhoneApp_60pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "LogoiPhoneApp_60pt@3x.png",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"idiom" : "ipad",
"filename" : "LogoiPadNotifications_20pt.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"idiom" : "ipad",
"filename" : "LogoiPadNotifications_20pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"idiom" : "ipad",
"filename" : "LogoiPadSpootlight5_29pt.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"idiom" : "ipad",
"filename" : "LogoiPadSpootlight5_29pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"idiom" : "ipad",
"filename" : "LogoiPadSpootlight7_40pt.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"idiom" : "ipad",
"filename" : "LogoiPadSpootlight7_40pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"idiom" : "ipad",
"filename" : "LogoiPadApp_76pt.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"idiom" : "ipad",
"filename" : "LogoiPadApp_76pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Logostore_1024pt.png",
"scale" : "1x"
},
{
"size" : "83,5x83,5",
"idiom" : "ipad",
"filename" : "LogoiPadProApp_83,5pt@2x.png",
"scale" : "2x"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Example/ExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ExampleViewController: UIViewController {

// Setting custom format pattern for some countries
topTextField.customPhoneFormats = ["RU" : "# ### ### ## ##",
"GB": "## #### #########"]
"IN": "## #### #########"]

// You can also add NKVPhonePickerTextField programmatically ;)
addingProgrammatically()
Expand Down
2 changes: 1 addition & 1 deletion Example/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1.0</string>
<string>1.2.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
2 changes: 1 addition & 1 deletion NKVPhonePicker.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

Pod::Spec.new do |s|
s.name = 'NKVPhonePicker'
s.version = '1.1.0'
s.version = '1.2.0'
s.summary = 'A UITextField subclass to simplify the selection of country codes.'
s.description = <<-DESC
With this pod you can easily select country codes with just making your textFields class - the NKVPhonePickerTextField.
Expand Down
25 changes: 18 additions & 7 deletions NKVPhonePicker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
EB8491E71ED4370E0069CD20 /* NKVPhonePickerTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB8491E61ED4370E0069CD20 /* NKVPhonePickerTextField.swift */; };
EB8492001ED467FE0069CD20 /* NKVFlagView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB8491FF1ED467FE0069CD20 /* NKVFlagView.swift */; };
EBD53F561ED6E64F007510E3 /* NKVPhoneFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBD53F551ED6E64F007510E3 /* NKVPhoneFormatter.swift */; };
EBD53F5A1ED73C0F007510E3 /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = EBD53F581ED73C0F007510E3 /* README.md */; };
EBD53F601ED829A3007510E3 /* NKVPhonePicker.podspec in Resources */ = {isa = PBXBuildFile; fileRef = EBD53F5F1ED829A3007510E3 /* NKVPhonePicker.podspec */; };
EBD60A681ED5D4170039A3AE /* NKVLocalizationHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBD60A671ED5D4170039A3AE /* NKVLocalizationHelper.swift */; };
EBEEE4E41ED62319007F9981 /* NKVSourcesHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBEEE4E31ED62319007F9981 /* NKVSourcesHelper.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -176,12 +174,13 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = nik.kov;
TargetAttributes = {
EB8491301ED435260069CD20 = {
CreatedOnToolsVersion = 8.3;
DevelopmentTeam = T4Q29AP976;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -214,7 +213,6 @@
EB84913A1ED435260069CD20 /* Main.storyboard in Resources */,
EB50FA291ED8506700722C25 /* Countries.bundle in Resources */,
EB50FA2A1ED8506700722C25 /* CountriesViewController.storyboard in Resources */,
EBD53F601ED829A3007510E3 /* NKVPhonePicker.podspec in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -227,7 +225,6 @@
files = (
EB8491E71ED4370E0069CD20 /* NKVPhonePickerTextField.swift in Sources */,
EB8491B01ED435AB0069CD20 /* CountriesViewController.swift in Sources */,
EBD53F5A1ED73C0F007510E3 /* README.md in Sources */,
EB5621461F50B3B100398954 /* TextFieldWithPattern.swift in Sources */,
EB8491371ED435260069CD20 /* ExampleViewController.swift in Sources */,
EBD53F561ED6E64F007510E3 /* NKVPhoneFormatter.swift in Sources */,
Expand Down Expand Up @@ -273,15 +270,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = 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_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_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -324,15 +327,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = 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_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_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -367,7 +376,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.NKVPhonePicker;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -381,7 +391,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.NKVPhonePicker;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -45,6 +46,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
15 changes: 9 additions & 6 deletions Sources/Views/NKVPhonePickerTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
// nik-kov.com
//

import Foundation
import UIKit

open class NKVPhonePickerTextField: TextFieldPatternFormat {
// MARK: Interface
// MARK: Settings
// MARK: - Settings
/// Set this property in order to present the CountryPickerViewController
/// when user clicks on the flag button
@IBOutlet public weak var phonePickerDelegate: UIViewController?
Expand Down Expand Up @@ -134,7 +135,9 @@ open class NKVPhonePickerTextField: TextFieldPatternFormat {
// With code initialization you always must define textField's height
// in order to properly add a plus label.
@available(*, unavailable)
init() { super.init(frame: CGRect.zero) }
init() {
super.init(frame: CGRect.zero)
}

override init(frame: CGRect) {
super.init(frame: frame)
Expand All @@ -152,8 +155,8 @@ open class NKVPhonePickerTextField: TextFieldPatternFormat {
}

private func initialize() {
self.leftViewMode = .always;
self.keyboardType = .numberPad
self.leftViewMode = .always
self.keyboardType = .phonePad
flagView = NKVFlagView(with: self)
self.leftView = flagView
self.delegate = self
Expand Down Expand Up @@ -210,11 +213,11 @@ open class NKVPhonePickerTextField: TextFieldPatternFormat {
pickerVC.countriesVCNavigationItem.title = pickerTitle
}
if let pickerTitleFont = pickerTitleFont, let navController = pickerVC.navigationController {
let fontAttributes = [NSFontAttributeName: pickerTitleFont]
let fontAttributes = [NSAttributedStringKey.font: pickerTitleFont]
navController.navigationBar.titleTextAttributes = fontAttributes
}
if let pickerCancelButtonFont = pickerCancelButtonFont {
let fontAttributes = [NSFontAttributeName: pickerCancelButtonFont]
let fontAttributes = [NSAttributedStringKey.font: pickerCancelButtonFont]
pickerVC.countriesVCNavigationItem.leftBarButtonItem?.setTitleTextAttributes(fontAttributes, for: .normal)
pickerVC.countriesVCNavigationItem.leftBarButtonItem?.setTitleTextAttributes(fontAttributes, for: .highlighted)
}
Expand Down
Loading

0 comments on commit 0b57ef1

Please sign in to comment.