Skip to content

Commit

Permalink
Fixes with privateness.
Browse files Browse the repository at this point in the history
  • Loading branch information
NikKovIos committed Mar 1, 2018
1 parent 7745e75 commit 8e0ede1
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 31 deletions.
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>2.0.0</string>
<string>2.0.1</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 = '2.0.0'
s.version = '2.0.1'
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
4 changes: 4 additions & 0 deletions NKVPhonePicker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
EB1D35E62045F3B900DC9560 /* NKVPhonePickerPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB1D35E52045F3B900DC9560 /* NKVPhonePickerPresenter.swift */; };
EB1D35E82045F74400DC9560 /* CountryCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB1D35E72045F74400DC9560 /* CountryCode.swift */; };
EB1D35EA2045F76C00DC9560 /* PhoneExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB1D35E92045F76C00DC9560 /* PhoneExtension.swift */; };
EB1D35F520481B4E00DC9560 /* NKVSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB1D35F420481B4E00DC9560 /* NKVSource.swift */; };
EB50FA291ED8506700722C25 /* Countries.bundle in Resources */ = {isa = PBXBuildFile; fileRef = EB50FA271ED8506700722C25 /* Countries.bundle */; };
EB50FA2A1ED8506700722C25 /* CountriesViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EB50FA281ED8506700722C25 /* CountriesViewController.storyboard */; };
EB5621461F50B3B100398954 /* TextFieldWithPattern.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB5621451F50B3B100398954 /* TextFieldWithPattern.swift */; };
Expand All @@ -31,6 +32,7 @@
EB1D35E52045F3B900DC9560 /* NKVPhonePickerPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NKVPhonePickerPresenter.swift; sourceTree = "<group>"; };
EB1D35E72045F74400DC9560 /* CountryCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountryCode.swift; sourceTree = "<group>"; };
EB1D35E92045F76C00DC9560 /* PhoneExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhoneExtension.swift; sourceTree = "<group>"; };
EB1D35F420481B4E00DC9560 /* NKVSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NKVSource.swift; sourceTree = "<group>"; };
EB50FA271ED8506700722C25 /* Countries.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = Countries.bundle; path = Bundle/Countries.bundle; sourceTree = "<group>"; };
EB50FA281ED8506700722C25 /* CountriesViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = CountriesViewController.storyboard; path = Bundle/CountriesViewController.storyboard; sourceTree = "<group>"; };
EB5621451F50B3B100398954 /* TextFieldWithPattern.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldWithPattern.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -130,6 +132,7 @@
EB84919D1ED435AB0069CD20 /* Country.swift */,
EB1D35E72045F74400DC9560 /* CountryCode.swift */,
EB1D35E92045F76C00DC9560 /* PhoneExtension.swift */,
EB1D35F420481B4E00DC9560 /* NKVSource.swift */,
);
path = Models;
sourceTree = "<group>";
Expand Down Expand Up @@ -236,6 +239,7 @@
EB8491E71ED4370E0069CD20 /* NKVPhonePickerTextField.swift in Sources */,
EB8491B01ED435AB0069CD20 /* CountriesViewController.swift in Sources */,
EB5621461F50B3B100398954 /* TextFieldWithPattern.swift in Sources */,
EB1D35F520481B4E00DC9560 /* NKVSource.swift in Sources */,
EB8491371ED435260069CD20 /* ExampleViewController.swift in Sources */,
EBD53F561ED6E64F007510E3 /* NKVPhoneFormatter.swift in Sources */,
EB1D35E62045F3B900DC9560 /* NKVPhonePickerPresenter.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

![Cocoapods](https://img.shields.io/badge/pod-available-brightgreen.svg?style=flat)
![Platform](https://img.shields.io/badge/platform-ios-blue.svg?style=flat)
![Version](https://img.shields.io/badge/version-2.0.0-blue.svg?style=flat)
![Version](https://img.shields.io/badge/version-2.0.1-blue.svg?style=flat)
![Swift version](https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat)
![License](https://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat)

Expand Down
18 changes: 0 additions & 18 deletions Sources/Helpers/NKVSourcesHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,6 @@

import UIKit

public enum NKVSource {
case country(Country)
case code(CountryCode)
case phoneExtension(PhoneExtension)

init(country: Country) {
self = .country(country)
}

init(countryCode: String) {
self = .code(CountryCode(countryCode))
}

init(phoneExtension: String) {
self = .phoneExtension(PhoneExtension(phoneExtension))
}
}

struct NKVSourcesHelper {

/// Gives the flag image, if it exists in bundle.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Main/NKVPhonePickerTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ open class NKVPhonePickerTextField: TextFieldPatternFormat {
super.init(frame: CGRect.zero)
}

override init(frame: CGRect) {
override public init(frame: CGRect) {
super.init(frame: frame)
initialize()
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/Models/Country.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
import Foundation
import UIKit

public class Country: NSObject {
open class Country: NSObject {

// MARK: - Properties

/// Ex: "RU"
public var countryCode: String
@objc public var countryCode: String
/// Ex: "7"
@objc public var phoneExtension: String
/// Ex: "Russia"
@objc public var name: String {
return NKVLocalizationHelper.countryName(by: countryCode) ?? ""
}
/// Ex: "### ## ######"
public var formatPattern: String
@objc public var formatPattern: String
/// A flag image for this country. May be nil.
public var flag: UIImage? {
return NKVSourcesHelper.flag(for: NKVSource(country: self))
Expand Down
6 changes: 3 additions & 3 deletions Sources/Models/CountryCode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//

public struct CountryCode {
var code: String
public var code: String

init?(_ source: NKVSource) {
public init?(_ source: NKVSource) {
switch source {
case .country(let country):
self.code = country.countryCode
Expand All @@ -24,7 +24,7 @@ public struct CountryCode {
}
}

init(_ countryCode: String) {
public init(_ countryCode: String) {
self.code = countryCode
}
}
25 changes: 25 additions & 0 deletions Sources/Models/NKVSource.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// NKVSource.swift
// NKVPhonePicker
//
// Created by Nik Kov on 01.03.18.
// Copyright © 2018 nik.kov. All rights reserved.
//

public enum NKVSource {
case country(Country)
case code(CountryCode)
case phoneExtension(PhoneExtension)

public init(country: Country) {
self = .country(country)
}

public init(countryCode: String) {
self = .code(CountryCode(countryCode))
}

public init(phoneExtension: String) {
self = .phoneExtension(PhoneExtension(phoneExtension))
}
}
6 changes: 3 additions & 3 deletions Sources/Models/PhoneExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//

public struct PhoneExtension {
var phoneExtension: String
public var phoneExtension: String

init?(source: NKVSource) {
public init?(source: NKVSource) {
switch source {
case .country(let country):
self.phoneExtension = country.phoneExtension
Expand All @@ -24,7 +24,7 @@ public struct PhoneExtension {
}
}

init(_ phoneExtension: String) {
public init(_ phoneExtension: String) {
self.phoneExtension = phoneExtension
}
}

0 comments on commit 8e0ede1

Please sign in to comment.