Skip to content

Commit

Permalink
Merge pull request #26 from nfhipona/updates/code-cleanup-n-tweaks
Browse files Browse the repository at this point in the history
Upgrade codebase and other optimization tweaks
  • Loading branch information
nfhipona authored Sep 4, 2023
2 parents d505abc + 35bba9e commit 18ea8e3
Show file tree
Hide file tree
Showing 48 changed files with 641 additions and 838 deletions.
2 changes: 1 addition & 1 deletion AutoCompleteTextField.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.name = "AutoCompleteTextField"
s.version = "0.5.0"
s.swift_version = "5"
s.platform = :ios, '10.0'
s.platform = :ios, '12.0'
s.summary = "TextField Subclass with auto completion feature."

# This description is used to generate tags and improve search results.
Expand Down
22 changes: 12 additions & 10 deletions Example/AutoCompleteTextField.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-AutoCompleteTextField_Example/Pods-AutoCompleteTextField_Example-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/AutoCompleteTextField-iOS10.0/AutoCompleteTextField.framework",
"${BUILT_PRODUCTS_DIR}/AutoCompleteTextField/AutoCompleteTextField.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
Expand All @@ -290,7 +290,7 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-AutoCompleteTextField_Tests/Pods-AutoCompleteTextField_Tests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/AutoCompleteTextField-iOS8.3/AutoCompleteTextField.framework",
"${BUILT_PRODUCTS_DIR}/AutoCompleteTextField/AutoCompleteTextField.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
Expand Down Expand Up @@ -427,7 +427,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -476,7 +476,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand All @@ -488,11 +488,11 @@
isa = XCBuildConfiguration;
baseConfigurationReference = E84DB578C3FFC175EE2EBDA1 /* Pods-AutoCompleteTextField_Example.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = RKF34AM7UT;
INFOPLIST_FILE = AutoCompleteTextField/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
Expand All @@ -506,11 +506,11 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 651D3C0C3080C0E54BC0ED3B /* Pods-AutoCompleteTextField_Example.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = RKF34AM7UT;
INFOPLIST_FILE = AutoCompleteTextField/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
Expand All @@ -524,7 +524,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 726789C5EAA36CFFB463E190 /* Pods-AutoCompleteTextField_Tests.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
BUNDLE_LOADER = "$(TEST_HOST)";
DEVELOPMENT_TEAM = RKF34AM7UT;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -536,6 +536,7 @@
"$(inherited)",
);
INFOPLIST_FILE = Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -549,14 +550,15 @@
isa = XCBuildConfiguration;
baseConfigurationReference = F457A2F76CC4C18A939B3148 /* Pods-AutoCompleteTextField_Tests.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
BUNDLE_LOADER = "$(TEST_HOST)";
DEVELOPMENT_TEAM = RKF34AM7UT;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
INFOPLIST_FILE = Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
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 = "1140"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
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.
Original file line number Diff line number Diff line change
@@ -1,48 +1,62 @@
{
"images" : [
{
"filename" : "40.jpg",
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "60.jpg",
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
"scale" : "3x",
"size" : "20x20"
},
{
"filename" : "58.jpg",
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "87.jpg",
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
"scale" : "3x",
"size" : "29x29"
},
{
"filename" : "80.jpg",
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "120.jpg",
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
"scale" : "3x",
"size" : "40x40"
},
{
"filename" : "120 1.jpg",
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
"scale" : "2x",
"size" : "60x60"
},
{
"filename" : "180.jpg",
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
"scale" : "3x",
"size" : "60x60"
},
{
"filename" : "1024.jpg",
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
24 changes: 12 additions & 12 deletions Example/AutoCompleteTextField/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Actf Data Source-->
<!--View Controller-->
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModule="AutoCompleteTextField_Example" customModuleProvider="target" sceneMemberID="viewController">
Expand All @@ -23,30 +20,33 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Login Example" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="IDj-2z-Ju1">
<rect key="frame" x="31" y="15" width="314" height="102.5"/>
<rect key="frame" x="31" y="35" width="314" height="204.5"/>
<fontDescription key="fontDescription" name="MarkerFelt-Thin" family="Marker Felt" pointSize="94"/>
<color key="textColor" red="0.29019607843137252" green="0.56470588235294117" blue="0.88627450980392153" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Email" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="nbC-ny-Jva" customClass="AutoCompleteTextField" customModule="AutoCompleteTextField">
<rect key="frame" x="31" y="172" width="314" height="30"/>
<rect key="frame" x="31" y="294" width="314" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" returnKeyType="next"/>
<connections>
<outlet property="_actfDataSource" destination="vXZ-lx-hvc" id="HUI-U2-pN4"/>
<outlet property="_actfDelegate" destination="vXZ-lx-hvc" id="8b1-ya-jm8"/>
<outlet property="delegate" destination="vXZ-lx-hvc" id="9OX-wp-tMX"/>
</connections>
</textField>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Re-enter Email" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="LlU-dr-1JJ" customClass="AutoCompleteTextField" customModule="AutoCompleteTextField">
<rect key="frame" x="31" y="216" width="314" height="30"/>
<rect key="frame" x="31" y="342" width="314" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" returnKeyType="next"/>
<connections>
<outlet property="actfDataSource" destination="vXZ-lx-hvc" id="UFs-LX-olQ"/>
<outlet property="_actfDataSource" destination="vXZ-lx-hvc" id="BCp-Kg-abN"/>
<outlet property="_actfDelegate" destination="vXZ-lx-hvc" id="T1e-Xa-ZzZ"/>
<outlet property="delegate" destination="vXZ-lx-hvc" id="Fb2-3q-HAl"/>
</connections>
</textField>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Password" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="cG3-ol-51a" customClass="AutoCompleteTextField" customModule="AutoCompleteTextField">
<rect key="frame" x="31" y="261" width="314" height="30"/>
<rect key="frame" x="31" y="391" width="314" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" returnKeyType="done" secureTextEntry="YES"/>
<connections>
Expand Down
54 changes: 32 additions & 22 deletions Example/AutoCompleteTextField/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit
import AutoCompleteTextField

class ViewController: UIViewController, ACTFDataSource, UITextFieldDelegate {
class ViewController: UIViewController, ACTFDataSource, ACTFDelegate, UITextFieldDelegate {

@IBOutlet weak var txtEmail: AutoCompleteTextField!
@IBOutlet weak var txtReEmail: AutoCompleteTextField!
Expand Down Expand Up @@ -53,30 +53,35 @@ class ViewController: UIViewController, ACTFDataSource, UITextFieldDelegate {
actfWithDelegateAndDataSource.backgroundColor = .red
view.addSubview(actfWithDelegateAndDataSource)*/

let g1 = ACTFDomain(text: "gmail.com", weight: 10)
let g2 = ACTFDomain(text: "googlemail.com", weight: 5)
let g3 = ACTFDomain(text: "google.com", weight: 4)
let g4 = ACTFDomain(text: "georgetown.edu", weight: 1)
weightedDomains = [g1, g2, g3, g4]

// store single
if g1.store(withKey: "Domain") {
print("Store success")
}
// store multiple
if ACTFDomain.store(domains: weightedDomains, withKey: "Domains") {
print("Store success")
let keys = ["gmail.com", "googlemail.com", "google.com", "georgetown.edu"]
let retriedDomains = ACTFDomain.domain(for: keys)
if retriedDomains.count > 0 {
weightedDomains = retriedDomains
} else {
let g1 = ACTFDomain(text: "gmail.com", weight: 10)
let g2 = ACTFDomain(text: "googlemail.com", weight: 5)
let g3 = ACTFDomain(text: "google.com", weight: 4)
let g4 = ACTFDomain(text: "georgetown.edu", weight: 1)
weightedDomains = [g1, g2, g3, g4]

// store single
if g1.store() {
print("Store: \(g1.text) success")
}

// store multiple
let errors = ACTFDomain.store(domains: weightedDomains)
if errors.count > 0 {
print("Store domain errors: ", errors)
}
}

// retrieved single
if let domain = ACTFDomain.domain(forKey: "Domain") {
print("Retrieved: ", domain)
}

// retrieved multiple
if let domains = ACTFDomain.domains(forKey: "Domains") {
print("Retrieved: ", domains)
if let domain = ACTFDomain.domain(for: "gmail.com") {
print("Retrieved single: ", domain.text, domain.weight)
}

print("Retrieved domains: ", retriedDomains.map ({ "Domain: \($0.text) - weight: \($0.weight)" }))
}

override func didReceiveMemoryWarning() {
Expand All @@ -91,6 +96,12 @@ class ViewController: UIViewController, ACTFDataSource, UITextFieldDelegate {
return weightedDomains // AutoCompleteTextField.domainNames // [ACTFDomain(text: "gmail.com", weight: 0), ACTFDomain(text: "hotmail.com", weight: 0), ACTFDomain(text: "domain.net", weight: 0)]
}

// MARK: - ACTFDelegate

func autoCompleteTextField(_ autoCompleteTextField: AutoCompleteTextField, didSuggestDomain domain: ACTFDomain) {
print("Suggested domain: \(domain.text) - weight: \(domain.weight)")
}

// MARK: - UITextFieldDelegate

func textFieldShouldReturn(_ textField: UITextField) -> Bool {
Expand All @@ -104,4 +115,3 @@ class ViewController: UIViewController, ACTFDataSource, UITextFieldDelegate {
}
}
}

2 changes: 1 addition & 1 deletion Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
platform :ios, '10.0'
platform :ios, '12.0'

target 'AutoCompleteTextField_Example' do
pod 'AutoCompleteTextField', :path => '../'
Expand Down
8 changes: 4 additions & 4 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- AutoCompleteTextField (0.4.1)
- AutoCompleteTextField (0.5.0)

DEPENDENCIES:
- AutoCompleteTextField (from `../`)
Expand All @@ -9,8 +9,8 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
AutoCompleteTextField: ee9b4c15f5bd502624f6fa490a3bcaf4a092693e
AutoCompleteTextField: c1b32c142962ae80aadb99004eb476dd4de389cc

PODFILE CHECKSUM: 01930a76e67305cd0386e054f0f20556c07b4e48
PODFILE CHECKSUM: d8fc9a379abb86079c1b5accdee030f2643eea46

COCOAPODS: 1.9.1
COCOAPODS: 1.12.1
15 changes: 7 additions & 8 deletions Example/Pods/Local Podspecs/AutoCompleteTextField.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 18ea8e3

Please sign in to comment.