├── FetchContactListSwift3 ├── FetchContactListSwift3.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── piyushsinroja.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── piyushsinroja.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── FetchContactListSwift3.xcscheme │ │ └── xcschememanagement.plist ├── FetchContactListSwift3 │ ├── AddContactVC.swift │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Images │ │ │ ├── Contents.json │ │ │ ├── add.imageset │ │ │ ├── Contents.json │ │ │ ├── add_referral-1.png │ │ │ ├── add_referral-2.png │ │ │ └── add_referral.png │ │ │ ├── search.imageset │ │ │ ├── Contents.json │ │ │ ├── search-1.png │ │ │ ├── search-2.png │ │ │ └── search.png │ │ │ ├── search_picker.imageset │ │ │ ├── Contents.json │ │ │ ├── search_picker-1.png │ │ │ ├── search_picker-2.png │ │ │ └── search_picker.png │ │ │ └── tick.imageset │ │ │ ├── Contents.json │ │ │ ├── tick-1.png │ │ │ ├── tick-2.png │ │ │ └── tick.png │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── ContactTableCell.swift │ ├── CountryCodes.json │ ├── CountryListPopUpView │ │ ├── CountryListPopUpView.swift │ │ ├── CountryListPopUpView.xib │ │ ├── CountryListTableCell.swift │ │ └── CountryListTableCell.xib │ ├── Info.plist │ └── ViewController.swift ├── FetchContactListSwift3Tests │ ├── FetchContactListSwift3Tests.swift │ └── Info.plist └── FetchContactListSwift3UITests │ ├── FetchContactListSwift3UITests.swift │ └── Info.plist ├── Images ├── Simulator Screen Shot 09-Feb-2017, 5.32.32 PM.jpg ├── Simulator Screen Shot 09-Feb-2017, 5.32.37 PM.jpg ├── Simulator Screen Shot 09-Feb-2017, 5.32.49 PM.jpg ├── Simulator Screen Shot 09-Feb-2017, 5.32.54 PM.jpg └── Simulator Screen Shot 09-Feb-2017, 5.59.31 PM.jpg ├── LICENSE └── README.md /FetchContactListSwift3/FetchContactListSwift3.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1C23638A1E27BFFD00E26155 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C2363891E27BFFD00E26155 /* AppDelegate.swift */; }; 11 | 1C23638C1E27BFFD00E26155 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C23638B1E27BFFD00E26155 /* ViewController.swift */; }; 12 | 1C23638F1E27BFFE00E26155 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1C23638D1E27BFFE00E26155 /* Main.storyboard */; }; 13 | 1C2363911E27BFFE00E26155 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1C2363901E27BFFE00E26155 /* Assets.xcassets */; }; 14 | 1C2363941E27BFFE00E26155 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1C2363921E27BFFE00E26155 /* LaunchScreen.storyboard */; }; 15 | 1C23639F1E27BFFF00E26155 /* FetchContactListSwift3Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C23639E1E27BFFF00E26155 /* FetchContactListSwift3Tests.swift */; }; 16 | 1C2363AA1E27BFFF00E26155 /* FetchContactListSwift3UITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C2363A91E27BFFF00E26155 /* FetchContactListSwift3UITests.swift */; }; 17 | 1C2363B91E27C05A00E26155 /* Contacts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C2363B81E27C05A00E26155 /* Contacts.framework */; }; 18 | 1C2363BB1E27C05F00E26155 /* ContactsUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C2363BA1E27C05F00E26155 /* ContactsUI.framework */; }; 19 | 1C2363BD1E27C23C00E26155 /* CountryCodes.json in Resources */ = {isa = PBXBuildFile; fileRef = 1C2363BC1E27C23C00E26155 /* CountryCodes.json */; }; 20 | 1C2363BF1E27C58700E26155 /* ContactTableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C2363BE1E27C58700E26155 /* ContactTableCell.swift */; }; 21 | 1C2363C11E27CF9500E26155 /* AddContactVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C2363C01E27CF9500E26155 /* AddContactVC.swift */; }; 22 | 1C490EC81E4C85AB004AA5D8 /* ContactHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C490EC71E4C85AB004AA5D8 /* ContactHelper.swift */; }; 23 | 1C5D51861E28B57100A3068F /* CountryListPopUpView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C5D51821E28B57100A3068F /* CountryListPopUpView.swift */; }; 24 | 1C5D51871E28B57100A3068F /* CountryListPopUpView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1C5D51831E28B57100A3068F /* CountryListPopUpView.xib */; }; 25 | 1C5D51881E28B57100A3068F /* CountryListTableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C5D51841E28B57100A3068F /* CountryListTableCell.swift */; }; 26 | 1C5D51891E28B57100A3068F /* CountryListTableCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1C5D51851E28B57100A3068F /* CountryListTableCell.xib */; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXContainerItemProxy section */ 30 | 1C23639B1E27BFFF00E26155 /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 1C23637E1E27BFFD00E26155 /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 1C2363851E27BFFD00E26155; 35 | remoteInfo = FetchContactListSwift3; 36 | }; 37 | 1C2363A61E27BFFF00E26155 /* PBXContainerItemProxy */ = { 38 | isa = PBXContainerItemProxy; 39 | containerPortal = 1C23637E1E27BFFD00E26155 /* Project object */; 40 | proxyType = 1; 41 | remoteGlobalIDString = 1C2363851E27BFFD00E26155; 42 | remoteInfo = FetchContactListSwift3; 43 | }; 44 | /* End PBXContainerItemProxy section */ 45 | 46 | /* Begin PBXFileReference section */ 47 | 1C2363861E27BFFD00E26155 /* FetchContactListSwift3.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FetchContactListSwift3.app; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 1C2363891E27BFFD00E26155 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 49 | 1C23638B1E27BFFD00E26155 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 50 | 1C23638E1E27BFFE00E26155 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 51 | 1C2363901E27BFFE00E26155 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 52 | 1C2363931E27BFFE00E26155 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 53 | 1C2363951E27BFFE00E26155 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | 1C23639A1E27BFFF00E26155 /* FetchContactListSwift3Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FetchContactListSwift3Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 1C23639E1E27BFFF00E26155 /* FetchContactListSwift3Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchContactListSwift3Tests.swift; sourceTree = ""; }; 56 | 1C2363A01E27BFFF00E26155 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | 1C2363A51E27BFFF00E26155 /* FetchContactListSwift3UITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FetchContactListSwift3UITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 58 | 1C2363A91E27BFFF00E26155 /* FetchContactListSwift3UITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchContactListSwift3UITests.swift; sourceTree = ""; }; 59 | 1C2363AB1E27C00000E26155 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | 1C2363B81E27C05A00E26155 /* Contacts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Contacts.framework; path = System/Library/Frameworks/Contacts.framework; sourceTree = SDKROOT; }; 61 | 1C2363BA1E27C05F00E26155 /* ContactsUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ContactsUI.framework; path = System/Library/Frameworks/ContactsUI.framework; sourceTree = SDKROOT; }; 62 | 1C2363BC1E27C23C00E26155 /* CountryCodes.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = CountryCodes.json; sourceTree = ""; }; 63 | 1C2363BE1E27C58700E26155 /* ContactTableCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactTableCell.swift; sourceTree = ""; }; 64 | 1C2363C01E27CF9500E26155 /* AddContactVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddContactVC.swift; sourceTree = ""; }; 65 | 1C490EC71E4C85AB004AA5D8 /* ContactHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Contact\U0010Helper.swift"; sourceTree = ""; }; 66 | 1C5D51821E28B57100A3068F /* CountryListPopUpView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CountryListPopUpView.swift; sourceTree = ""; }; 67 | 1C5D51831E28B57100A3068F /* CountryListPopUpView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CountryListPopUpView.xib; sourceTree = ""; }; 68 | 1C5D51841E28B57100A3068F /* CountryListTableCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CountryListTableCell.swift; sourceTree = ""; }; 69 | 1C5D51851E28B57100A3068F /* CountryListTableCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CountryListTableCell.xib; sourceTree = ""; }; 70 | /* End PBXFileReference section */ 71 | 72 | /* Begin PBXFrameworksBuildPhase section */ 73 | 1C2363831E27BFFD00E26155 /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | 1C2363BB1E27C05F00E26155 /* ContactsUI.framework in Frameworks */, 78 | 1C2363B91E27C05A00E26155 /* Contacts.framework in Frameworks */, 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | 1C2363971E27BFFF00E26155 /* Frameworks */ = { 83 | isa = PBXFrameworksBuildPhase; 84 | buildActionMask = 2147483647; 85 | files = ( 86 | ); 87 | runOnlyForDeploymentPostprocessing = 0; 88 | }; 89 | 1C2363A21E27BFFF00E26155 /* Frameworks */ = { 90 | isa = PBXFrameworksBuildPhase; 91 | buildActionMask = 2147483647; 92 | files = ( 93 | ); 94 | runOnlyForDeploymentPostprocessing = 0; 95 | }; 96 | /* End PBXFrameworksBuildPhase section */ 97 | 98 | /* Begin PBXGroup section */ 99 | 1C23637D1E27BFFD00E26155 = { 100 | isa = PBXGroup; 101 | children = ( 102 | 1C2363881E27BFFD00E26155 /* FetchContactListSwift3 */, 103 | 1C23639D1E27BFFF00E26155 /* FetchContactListSwift3Tests */, 104 | 1C2363A81E27BFFF00E26155 /* FetchContactListSwift3UITests */, 105 | 1C2363871E27BFFD00E26155 /* Products */, 106 | 1C2363B71E27C05900E26155 /* Frameworks */, 107 | ); 108 | sourceTree = ""; 109 | }; 110 | 1C2363871E27BFFD00E26155 /* Products */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 1C2363861E27BFFD00E26155 /* FetchContactListSwift3.app */, 114 | 1C23639A1E27BFFF00E26155 /* FetchContactListSwift3Tests.xctest */, 115 | 1C2363A51E27BFFF00E26155 /* FetchContactListSwift3UITests.xctest */, 116 | ); 117 | name = Products; 118 | sourceTree = ""; 119 | }; 120 | 1C2363881E27BFFD00E26155 /* FetchContactListSwift3 */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 1C490EC61E4C85AB004AA5D8 /* ContactHelper */, 124 | 1C5D51811E28B57100A3068F /* CountryListPopUpView */, 125 | 1C2363BC1E27C23C00E26155 /* CountryCodes.json */, 126 | 1C2363891E27BFFD00E26155 /* AppDelegate.swift */, 127 | 1C23638B1E27BFFD00E26155 /* ViewController.swift */, 128 | 1C2363C01E27CF9500E26155 /* AddContactVC.swift */, 129 | 1C2363BE1E27C58700E26155 /* ContactTableCell.swift */, 130 | 1C23638D1E27BFFE00E26155 /* Main.storyboard */, 131 | 1C2363901E27BFFE00E26155 /* Assets.xcassets */, 132 | 1C2363921E27BFFE00E26155 /* LaunchScreen.storyboard */, 133 | 1C2363951E27BFFE00E26155 /* Info.plist */, 134 | ); 135 | path = FetchContactListSwift3; 136 | sourceTree = ""; 137 | }; 138 | 1C23639D1E27BFFF00E26155 /* FetchContactListSwift3Tests */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 1C23639E1E27BFFF00E26155 /* FetchContactListSwift3Tests.swift */, 142 | 1C2363A01E27BFFF00E26155 /* Info.plist */, 143 | ); 144 | path = FetchContactListSwift3Tests; 145 | sourceTree = ""; 146 | }; 147 | 1C2363A81E27BFFF00E26155 /* FetchContactListSwift3UITests */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | 1C2363A91E27BFFF00E26155 /* FetchContactListSwift3UITests.swift */, 151 | 1C2363AB1E27C00000E26155 /* Info.plist */, 152 | ); 153 | path = FetchContactListSwift3UITests; 154 | sourceTree = ""; 155 | }; 156 | 1C2363B71E27C05900E26155 /* Frameworks */ = { 157 | isa = PBXGroup; 158 | children = ( 159 | 1C2363BA1E27C05F00E26155 /* ContactsUI.framework */, 160 | 1C2363B81E27C05A00E26155 /* Contacts.framework */, 161 | ); 162 | name = Frameworks; 163 | sourceTree = ""; 164 | }; 165 | 1C490EC61E4C85AB004AA5D8 /* ContactHelper */ = { 166 | isa = PBXGroup; 167 | children = ( 168 | 1C490EC71E4C85AB004AA5D8 /* ContactHelper.swift */, 169 | ); 170 | path = ContactHelper; 171 | sourceTree = ""; 172 | }; 173 | 1C5D51811E28B57100A3068F /* CountryListPopUpView */ = { 174 | isa = PBXGroup; 175 | children = ( 176 | 1C5D51821E28B57100A3068F /* CountryListPopUpView.swift */, 177 | 1C5D51831E28B57100A3068F /* CountryListPopUpView.xib */, 178 | 1C5D51841E28B57100A3068F /* CountryListTableCell.swift */, 179 | 1C5D51851E28B57100A3068F /* CountryListTableCell.xib */, 180 | ); 181 | path = CountryListPopUpView; 182 | sourceTree = ""; 183 | }; 184 | /* End PBXGroup section */ 185 | 186 | /* Begin PBXNativeTarget section */ 187 | 1C2363851E27BFFD00E26155 /* FetchContactListSwift3 */ = { 188 | isa = PBXNativeTarget; 189 | buildConfigurationList = 1C2363AE1E27C00000E26155 /* Build configuration list for PBXNativeTarget "FetchContactListSwift3" */; 190 | buildPhases = ( 191 | 1C2363821E27BFFD00E26155 /* Sources */, 192 | 1C2363831E27BFFD00E26155 /* Frameworks */, 193 | 1C2363841E27BFFD00E26155 /* Resources */, 194 | ); 195 | buildRules = ( 196 | ); 197 | dependencies = ( 198 | ); 199 | name = FetchContactListSwift3; 200 | productName = FetchContactListSwift3; 201 | productReference = 1C2363861E27BFFD00E26155 /* FetchContactListSwift3.app */; 202 | productType = "com.apple.product-type.application"; 203 | }; 204 | 1C2363991E27BFFF00E26155 /* FetchContactListSwift3Tests */ = { 205 | isa = PBXNativeTarget; 206 | buildConfigurationList = 1C2363B11E27C00000E26155 /* Build configuration list for PBXNativeTarget "FetchContactListSwift3Tests" */; 207 | buildPhases = ( 208 | 1C2363961E27BFFF00E26155 /* Sources */, 209 | 1C2363971E27BFFF00E26155 /* Frameworks */, 210 | 1C2363981E27BFFF00E26155 /* Resources */, 211 | ); 212 | buildRules = ( 213 | ); 214 | dependencies = ( 215 | 1C23639C1E27BFFF00E26155 /* PBXTargetDependency */, 216 | ); 217 | name = FetchContactListSwift3Tests; 218 | productName = FetchContactListSwift3Tests; 219 | productReference = 1C23639A1E27BFFF00E26155 /* FetchContactListSwift3Tests.xctest */; 220 | productType = "com.apple.product-type.bundle.unit-test"; 221 | }; 222 | 1C2363A41E27BFFF00E26155 /* FetchContactListSwift3UITests */ = { 223 | isa = PBXNativeTarget; 224 | buildConfigurationList = 1C2363B41E27C00000E26155 /* Build configuration list for PBXNativeTarget "FetchContactListSwift3UITests" */; 225 | buildPhases = ( 226 | 1C2363A11E27BFFF00E26155 /* Sources */, 227 | 1C2363A21E27BFFF00E26155 /* Frameworks */, 228 | 1C2363A31E27BFFF00E26155 /* Resources */, 229 | ); 230 | buildRules = ( 231 | ); 232 | dependencies = ( 233 | 1C2363A71E27BFFF00E26155 /* PBXTargetDependency */, 234 | ); 235 | name = FetchContactListSwift3UITests; 236 | productName = FetchContactListSwift3UITests; 237 | productReference = 1C2363A51E27BFFF00E26155 /* FetchContactListSwift3UITests.xctest */; 238 | productType = "com.apple.product-type.bundle.ui-testing"; 239 | }; 240 | /* End PBXNativeTarget section */ 241 | 242 | /* Begin PBXProject section */ 243 | 1C23637E1E27BFFD00E26155 /* Project object */ = { 244 | isa = PBXProject; 245 | attributes = { 246 | LastSwiftUpdateCheck = 0820; 247 | LastUpgradeCheck = 0820; 248 | ORGANIZATIONNAME = Piyush; 249 | TargetAttributes = { 250 | 1C2363851E27BFFD00E26155 = { 251 | CreatedOnToolsVersion = 8.2.1; 252 | ProvisioningStyle = Automatic; 253 | }; 254 | 1C2363991E27BFFF00E26155 = { 255 | CreatedOnToolsVersion = 8.2.1; 256 | ProvisioningStyle = Automatic; 257 | TestTargetID = 1C2363851E27BFFD00E26155; 258 | }; 259 | 1C2363A41E27BFFF00E26155 = { 260 | CreatedOnToolsVersion = 8.2.1; 261 | ProvisioningStyle = Automatic; 262 | TestTargetID = 1C2363851E27BFFD00E26155; 263 | }; 264 | }; 265 | }; 266 | buildConfigurationList = 1C2363811E27BFFD00E26155 /* Build configuration list for PBXProject "FetchContactListSwift3" */; 267 | compatibilityVersion = "Xcode 3.2"; 268 | developmentRegion = English; 269 | hasScannedForEncodings = 0; 270 | knownRegions = ( 271 | en, 272 | Base, 273 | ); 274 | mainGroup = 1C23637D1E27BFFD00E26155; 275 | productRefGroup = 1C2363871E27BFFD00E26155 /* Products */; 276 | projectDirPath = ""; 277 | projectRoot = ""; 278 | targets = ( 279 | 1C2363851E27BFFD00E26155 /* FetchContactListSwift3 */, 280 | 1C2363991E27BFFF00E26155 /* FetchContactListSwift3Tests */, 281 | 1C2363A41E27BFFF00E26155 /* FetchContactListSwift3UITests */, 282 | ); 283 | }; 284 | /* End PBXProject section */ 285 | 286 | /* Begin PBXResourcesBuildPhase section */ 287 | 1C2363841E27BFFD00E26155 /* Resources */ = { 288 | isa = PBXResourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | 1C5D51871E28B57100A3068F /* CountryListPopUpView.xib in Resources */, 292 | 1C2363941E27BFFE00E26155 /* LaunchScreen.storyboard in Resources */, 293 | 1C2363911E27BFFE00E26155 /* Assets.xcassets in Resources */, 294 | 1C23638F1E27BFFE00E26155 /* Main.storyboard in Resources */, 295 | 1C2363BD1E27C23C00E26155 /* CountryCodes.json in Resources */, 296 | 1C5D51891E28B57100A3068F /* CountryListTableCell.xib in Resources */, 297 | ); 298 | runOnlyForDeploymentPostprocessing = 0; 299 | }; 300 | 1C2363981E27BFFF00E26155 /* Resources */ = { 301 | isa = PBXResourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | ); 305 | runOnlyForDeploymentPostprocessing = 0; 306 | }; 307 | 1C2363A31E27BFFF00E26155 /* Resources */ = { 308 | isa = PBXResourcesBuildPhase; 309 | buildActionMask = 2147483647; 310 | files = ( 311 | ); 312 | runOnlyForDeploymentPostprocessing = 0; 313 | }; 314 | /* End PBXResourcesBuildPhase section */ 315 | 316 | /* Begin PBXSourcesBuildPhase section */ 317 | 1C2363821E27BFFD00E26155 /* Sources */ = { 318 | isa = PBXSourcesBuildPhase; 319 | buildActionMask = 2147483647; 320 | files = ( 321 | 1C23638C1E27BFFD00E26155 /* ViewController.swift in Sources */, 322 | 1C5D51881E28B57100A3068F /* CountryListTableCell.swift in Sources */, 323 | 1C23638A1E27BFFD00E26155 /* AppDelegate.swift in Sources */, 324 | 1C2363BF1E27C58700E26155 /* ContactTableCell.swift in Sources */, 325 | 1C2363C11E27CF9500E26155 /* AddContactVC.swift in Sources */, 326 | 1C5D51861E28B57100A3068F /* CountryListPopUpView.swift in Sources */, 327 | 1C490EC81E4C85AB004AA5D8 /* ContactHelper.swift in Sources */, 328 | ); 329 | runOnlyForDeploymentPostprocessing = 0; 330 | }; 331 | 1C2363961E27BFFF00E26155 /* Sources */ = { 332 | isa = PBXSourcesBuildPhase; 333 | buildActionMask = 2147483647; 334 | files = ( 335 | 1C23639F1E27BFFF00E26155 /* FetchContactListSwift3Tests.swift in Sources */, 336 | ); 337 | runOnlyForDeploymentPostprocessing = 0; 338 | }; 339 | 1C2363A11E27BFFF00E26155 /* Sources */ = { 340 | isa = PBXSourcesBuildPhase; 341 | buildActionMask = 2147483647; 342 | files = ( 343 | 1C2363AA1E27BFFF00E26155 /* FetchContactListSwift3UITests.swift in Sources */, 344 | ); 345 | runOnlyForDeploymentPostprocessing = 0; 346 | }; 347 | /* End PBXSourcesBuildPhase section */ 348 | 349 | /* Begin PBXTargetDependency section */ 350 | 1C23639C1E27BFFF00E26155 /* PBXTargetDependency */ = { 351 | isa = PBXTargetDependency; 352 | target = 1C2363851E27BFFD00E26155 /* FetchContactListSwift3 */; 353 | targetProxy = 1C23639B1E27BFFF00E26155 /* PBXContainerItemProxy */; 354 | }; 355 | 1C2363A71E27BFFF00E26155 /* PBXTargetDependency */ = { 356 | isa = PBXTargetDependency; 357 | target = 1C2363851E27BFFD00E26155 /* FetchContactListSwift3 */; 358 | targetProxy = 1C2363A61E27BFFF00E26155 /* PBXContainerItemProxy */; 359 | }; 360 | /* End PBXTargetDependency section */ 361 | 362 | /* Begin PBXVariantGroup section */ 363 | 1C23638D1E27BFFE00E26155 /* Main.storyboard */ = { 364 | isa = PBXVariantGroup; 365 | children = ( 366 | 1C23638E1E27BFFE00E26155 /* Base */, 367 | ); 368 | name = Main.storyboard; 369 | sourceTree = ""; 370 | }; 371 | 1C2363921E27BFFE00E26155 /* LaunchScreen.storyboard */ = { 372 | isa = PBXVariantGroup; 373 | children = ( 374 | 1C2363931E27BFFE00E26155 /* Base */, 375 | ); 376 | name = LaunchScreen.storyboard; 377 | sourceTree = ""; 378 | }; 379 | /* End PBXVariantGroup section */ 380 | 381 | /* Begin XCBuildConfiguration section */ 382 | 1C2363AC1E27C00000E26155 /* Debug */ = { 383 | isa = XCBuildConfiguration; 384 | buildSettings = { 385 | ALWAYS_SEARCH_USER_PATHS = NO; 386 | CLANG_ANALYZER_NONNULL = YES; 387 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 388 | CLANG_CXX_LIBRARY = "libc++"; 389 | CLANG_ENABLE_MODULES = YES; 390 | CLANG_ENABLE_OBJC_ARC = YES; 391 | CLANG_WARN_BOOL_CONVERSION = YES; 392 | CLANG_WARN_CONSTANT_CONVERSION = YES; 393 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 394 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 395 | CLANG_WARN_EMPTY_BODY = YES; 396 | CLANG_WARN_ENUM_CONVERSION = YES; 397 | CLANG_WARN_INFINITE_RECURSION = YES; 398 | CLANG_WARN_INT_CONVERSION = YES; 399 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 400 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 401 | CLANG_WARN_UNREACHABLE_CODE = YES; 402 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 403 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 404 | COPY_PHASE_STRIP = NO; 405 | DEBUG_INFORMATION_FORMAT = dwarf; 406 | ENABLE_STRICT_OBJC_MSGSEND = YES; 407 | ENABLE_TESTABILITY = YES; 408 | GCC_C_LANGUAGE_STANDARD = gnu99; 409 | GCC_DYNAMIC_NO_PIC = NO; 410 | GCC_NO_COMMON_BLOCKS = YES; 411 | GCC_OPTIMIZATION_LEVEL = 0; 412 | GCC_PREPROCESSOR_DEFINITIONS = ( 413 | "DEBUG=1", 414 | "$(inherited)", 415 | ); 416 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 417 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 418 | GCC_WARN_UNDECLARED_SELECTOR = YES; 419 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 420 | GCC_WARN_UNUSED_FUNCTION = YES; 421 | GCC_WARN_UNUSED_VARIABLE = YES; 422 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 423 | MTL_ENABLE_DEBUG_INFO = YES; 424 | ONLY_ACTIVE_ARCH = YES; 425 | SDKROOT = iphoneos; 426 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 427 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 428 | TARGETED_DEVICE_FAMILY = "1,2"; 429 | }; 430 | name = Debug; 431 | }; 432 | 1C2363AD1E27C00000E26155 /* Release */ = { 433 | isa = XCBuildConfiguration; 434 | buildSettings = { 435 | ALWAYS_SEARCH_USER_PATHS = NO; 436 | CLANG_ANALYZER_NONNULL = YES; 437 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 438 | CLANG_CXX_LIBRARY = "libc++"; 439 | CLANG_ENABLE_MODULES = YES; 440 | CLANG_ENABLE_OBJC_ARC = YES; 441 | CLANG_WARN_BOOL_CONVERSION = YES; 442 | CLANG_WARN_CONSTANT_CONVERSION = YES; 443 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 444 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 445 | CLANG_WARN_EMPTY_BODY = YES; 446 | CLANG_WARN_ENUM_CONVERSION = YES; 447 | CLANG_WARN_INFINITE_RECURSION = YES; 448 | CLANG_WARN_INT_CONVERSION = YES; 449 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 450 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 451 | CLANG_WARN_UNREACHABLE_CODE = YES; 452 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 453 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 454 | COPY_PHASE_STRIP = NO; 455 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 456 | ENABLE_NS_ASSERTIONS = NO; 457 | ENABLE_STRICT_OBJC_MSGSEND = YES; 458 | GCC_C_LANGUAGE_STANDARD = gnu99; 459 | GCC_NO_COMMON_BLOCKS = YES; 460 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 461 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 462 | GCC_WARN_UNDECLARED_SELECTOR = YES; 463 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 464 | GCC_WARN_UNUSED_FUNCTION = YES; 465 | GCC_WARN_UNUSED_VARIABLE = YES; 466 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 467 | MTL_ENABLE_DEBUG_INFO = NO; 468 | SDKROOT = iphoneos; 469 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 470 | TARGETED_DEVICE_FAMILY = "1,2"; 471 | VALIDATE_PRODUCT = YES; 472 | }; 473 | name = Release; 474 | }; 475 | 1C2363AF1E27C00000E26155 /* Debug */ = { 476 | isa = XCBuildConfiguration; 477 | buildSettings = { 478 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 479 | INFOPLIST_FILE = FetchContactListSwift3/Info.plist; 480 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 481 | PRODUCT_BUNDLE_IDENTIFIER = com.FetchContactListSwift3; 482 | PRODUCT_NAME = "$(TARGET_NAME)"; 483 | SWIFT_VERSION = 3.0; 484 | }; 485 | name = Debug; 486 | }; 487 | 1C2363B01E27C00000E26155 /* Release */ = { 488 | isa = XCBuildConfiguration; 489 | buildSettings = { 490 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 491 | INFOPLIST_FILE = FetchContactListSwift3/Info.plist; 492 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 493 | PRODUCT_BUNDLE_IDENTIFIER = com.FetchContactListSwift3; 494 | PRODUCT_NAME = "$(TARGET_NAME)"; 495 | SWIFT_VERSION = 3.0; 496 | }; 497 | name = Release; 498 | }; 499 | 1C2363B21E27C00000E26155 /* Debug */ = { 500 | isa = XCBuildConfiguration; 501 | buildSettings = { 502 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 503 | BUNDLE_LOADER = "$(TEST_HOST)"; 504 | INFOPLIST_FILE = FetchContactListSwift3Tests/Info.plist; 505 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 506 | PRODUCT_BUNDLE_IDENTIFIER = com.FetchContactListSwift3; 507 | PRODUCT_NAME = "$(TARGET_NAME)"; 508 | SWIFT_VERSION = 3.0; 509 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FetchContactListSwift3.app/FetchContactListSwift3"; 510 | }; 511 | name = Debug; 512 | }; 513 | 1C2363B31E27C00000E26155 /* Release */ = { 514 | isa = XCBuildConfiguration; 515 | buildSettings = { 516 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 517 | BUNDLE_LOADER = "$(TEST_HOST)"; 518 | INFOPLIST_FILE = FetchContactListSwift3Tests/Info.plist; 519 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 520 | PRODUCT_BUNDLE_IDENTIFIER = com.FetchContactListSwift3; 521 | PRODUCT_NAME = "$(TARGET_NAME)"; 522 | SWIFT_VERSION = 3.0; 523 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FetchContactListSwift3.app/FetchContactListSwift3"; 524 | }; 525 | name = Release; 526 | }; 527 | 1C2363B51E27C00000E26155 /* Debug */ = { 528 | isa = XCBuildConfiguration; 529 | buildSettings = { 530 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 531 | INFOPLIST_FILE = FetchContactListSwift3UITests/Info.plist; 532 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 533 | PRODUCT_BUNDLE_IDENTIFIER = com.FetchContactListSwift3; 534 | PRODUCT_NAME = "$(TARGET_NAME)"; 535 | SWIFT_VERSION = 3.0; 536 | TEST_TARGET_NAME = FetchContactListSwift3; 537 | }; 538 | name = Debug; 539 | }; 540 | 1C2363B61E27C00000E26155 /* Release */ = { 541 | isa = XCBuildConfiguration; 542 | buildSettings = { 543 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 544 | INFOPLIST_FILE = FetchContactListSwift3UITests/Info.plist; 545 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 546 | PRODUCT_BUNDLE_IDENTIFIER = com.FetchContactListSwift3; 547 | PRODUCT_NAME = "$(TARGET_NAME)"; 548 | SWIFT_VERSION = 3.0; 549 | TEST_TARGET_NAME = FetchContactListSwift3; 550 | }; 551 | name = Release; 552 | }; 553 | /* End XCBuildConfiguration section */ 554 | 555 | /* Begin XCConfigurationList section */ 556 | 1C2363811E27BFFD00E26155 /* Build configuration list for PBXProject "FetchContactListSwift3" */ = { 557 | isa = XCConfigurationList; 558 | buildConfigurations = ( 559 | 1C2363AC1E27C00000E26155 /* Debug */, 560 | 1C2363AD1E27C00000E26155 /* Release */, 561 | ); 562 | defaultConfigurationIsVisible = 0; 563 | defaultConfigurationName = Release; 564 | }; 565 | 1C2363AE1E27C00000E26155 /* Build configuration list for PBXNativeTarget "FetchContactListSwift3" */ = { 566 | isa = XCConfigurationList; 567 | buildConfigurations = ( 568 | 1C2363AF1E27C00000E26155 /* Debug */, 569 | 1C2363B01E27C00000E26155 /* Release */, 570 | ); 571 | defaultConfigurationIsVisible = 0; 572 | defaultConfigurationName = Release; 573 | }; 574 | 1C2363B11E27C00000E26155 /* Build configuration list for PBXNativeTarget "FetchContactListSwift3Tests" */ = { 575 | isa = XCConfigurationList; 576 | buildConfigurations = ( 577 | 1C2363B21E27C00000E26155 /* Debug */, 578 | 1C2363B31E27C00000E26155 /* Release */, 579 | ); 580 | defaultConfigurationIsVisible = 0; 581 | defaultConfigurationName = Release; 582 | }; 583 | 1C2363B41E27C00000E26155 /* Build configuration list for PBXNativeTarget "FetchContactListSwift3UITests" */ = { 584 | isa = XCConfigurationList; 585 | buildConfigurations = ( 586 | 1C2363B51E27C00000E26155 /* Debug */, 587 | 1C2363B61E27C00000E26155 /* Release */, 588 | ); 589 | defaultConfigurationIsVisible = 0; 590 | defaultConfigurationName = Release; 591 | }; 592 | /* End XCConfigurationList section */ 593 | }; 594 | rootObject = 1C23637E1E27BFFD00E26155 /* Project object */; 595 | } 596 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3.xcodeproj/project.xcworkspace/xcuserdata/piyushsinroja.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/FetchContactListSwift3/FetchContactListSwift3.xcodeproj/project.xcworkspace/xcuserdata/piyushsinroja.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3.xcodeproj/xcuserdata/piyushsinroja.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 18 | 24 | 25 | 26 | 28 | 40 | 41 | 42 | 44 | 56 | 57 | 58 | 60 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3.xcodeproj/xcuserdata/piyushsinroja.xcuserdatad/xcschemes/FetchContactListSwift3.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3.xcodeproj/xcuserdata/piyushsinroja.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | FetchContactListSwift3.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 1C2363851E27BFFD00E26155 16 | 17 | primary 18 | 19 | 20 | 1C2363991E27BFFF00E26155 21 | 22 | primary 23 | 24 | 25 | 1C2363A41E27BFFF00E26155 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/AddContactVC.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AddContactVC.swift 3 | // FetchContactListSwift3 4 | // 5 | // Created by piyush sinroja on 12/01/17. 6 | // Copyright © 2017 Piyush. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Contacts 11 | import ContactsUI 12 | 13 | class AddContactVC: UIViewController , delegateCountry, UIGestureRecognizerDelegate{ 14 | 15 | let appdelObj: AppDelegate = UIApplication.shared.delegate as! AppDelegate 16 | 17 | //UITextField Outlets 18 | @IBOutlet weak var txtName: UITextField! 19 | @IBOutlet weak var txtMobile: UITextField! 20 | @IBOutlet weak var txtEmailId: UITextField! 21 | @IBOutlet weak var btnCountryCode: UIButton! 22 | 23 | //UIButton Outlets 24 | @IBOutlet weak var btnSave: UIButton! 25 | @IBOutlet weak var btnCancel: UIButton! 26 | 27 | //UIScrollView Outlet 28 | @IBOutlet weak var scrollview: UIScrollView! 29 | 30 | // Other Var 31 | var activeTextField: UITextField! 32 | var refCountryListView : CountryListPopUpView? = nil 33 | 34 | var contactModel: CNContact? 35 | var dicData: NSDictionary? 36 | 37 | override func viewDidLoad() { 38 | super.viewDidLoad() 39 | // Do any additional setup after loading the view. 40 | 41 | txtName.padding(width: 5) 42 | txtMobile.padding(width: 5) 43 | txtEmailId.padding(width: 5) 44 | 45 | txtName.cornerRadiusAndBorder() 46 | txtMobile.cornerRadiusAndBorder() 47 | txtEmailId.cornerRadiusAndBorder() 48 | btnCountryCode.cornerRadiusAndBorder() 49 | btnCancel.cornerRadiusAndBorder() 50 | btnSave.cornerRadiusAndBorder() 51 | 52 | NotificationCenter.default.addObserver(self, selector: #selector(AddContactVC.keyboardWasShown(aNotification:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil) 53 | 54 | NotificationCenter.default.addObserver(self, selector: #selector(AddContactVC.keyboardWillBeHidden(aNotification:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil) 55 | 56 | } 57 | 58 | override func viewWillAppear(_ animated: Bool) { 59 | ContactHelper.objContactHelper.delegateContact = self // Delegate refer Give 60 | 61 | if contactModel != nil && dicData != nil{ 62 | btnSave.setTitle("Update", for: UIControlState.normal) 63 | 64 | let name = dicData?.object(forKey: "fullname") as! String? 65 | let mobile = dicData?.object(forKey: "mobile") as! String? 66 | let isdcode = dicData?.object(forKey: "isdcode") as! String? 67 | 68 | // Name Display 69 | txtName.text = name 70 | 71 | var newString = "" 72 | if (mobile?.hasPrefix(isdcode!))! { 73 | let strremain = mobile?.substring(from: (mobile?.index((mobile?.startIndex)!, offsetBy: (isdcode?.characters.count)!))!) 74 | 75 | newString = strremain! 76 | } 77 | else{ 78 | newString = mobile! 79 | } 80 | 81 | // Mobile Number Display 82 | txtMobile.text = newString 83 | 84 | // Email Id Display 85 | if let emailId = dicData?.object(forKey: "email") as! String?{ 86 | txtEmailId.text = emailId 87 | } 88 | 89 | btnCountryCode.setTitle(isdcode, for: UIControlState.normal) 90 | } 91 | else{ 92 | btnSave.setTitle("Save", for: UIControlState.normal) 93 | } 94 | } 95 | 96 | override func didReceiveMemoryWarning() { 97 | super.didReceiveMemoryWarning() 98 | } 99 | 100 | // MARK: - Keyboard Notification Method 101 | func keyboardWasShown(aNotification: NSNotification) { 102 | 103 | if let userInfo = aNotification.userInfo { 104 | if let keyboardSize = (userInfo[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue { 105 | let contentInsets = UIEdgeInsets(top: 0, left: 0, bottom: keyboardSize.height, right: 0) 106 | 107 | scrollview.contentInset = contentInsets 108 | scrollview.scrollIndicatorInsets = contentInsets 109 | var aRect: CGRect = self.view.frame 110 | aRect.size.height -= keyboardSize.height 111 | } else { 112 | } 113 | } else { 114 | 115 | } 116 | } 117 | 118 | // Called when the UIKeyboardWillHideNotification is sent 119 | func keyboardWillBeHidden(aNotification: NSNotification) { 120 | UIView.animate(withDuration: 0.5, animations: {() -> Void in 121 | let contentInsets: UIEdgeInsets = .zero 122 | self.scrollview.contentInset = contentInsets 123 | self.scrollview.scrollIndicatorInsets = contentInsets 124 | }, completion: {(finished: Bool) -> Void in 125 | }) 126 | } 127 | 128 | //MARK:- Button Actions 129 | @IBAction func btnSave(_ sender: Any) { 130 | if !(txtName.text?.isEmpty)! && !(txtMobile.text?.isEmpty)!{ 131 | if btnSave.titleLabel?.text == "Save" { 132 | AddContact() 133 | } 134 | else{ 135 | updateData() 136 | } 137 | } 138 | } 139 | 140 | @IBAction func btnCountryCode(_ sender: Any) { 141 | activeTextField?.resignFirstResponder() 142 | let xibCountryListView = Bundle.main.loadNibNamed("CountryListPopUpView", owner: self, options: nil)?[0] as! CountryListPopUpView 143 | xibCountryListView.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: self.view.frame.size.height) 144 | xibCountryListView.delegate = self 145 | let tap = UITapGestureRecognizer(target: self, action: #selector(self.handleTap(sender:))) 146 | tap.delegate = self 147 | xibCountryListView.addGestureRecognizer(tap) 148 | tap.cancelsTouchesInView = true 149 | xibCountryListView.SetupCountryView() 150 | self.view.addSubview(xibCountryListView) 151 | refCountryListView = xibCountryListView 152 | } 153 | 154 | @IBAction func btnCancel(_ sender: Any) { 155 | activeTextField?.resignFirstResponder() 156 | DispatchQueue.main.asyncAfter(deadline: .now()) { 157 | self.dismiss(animated: true, completion: nil) 158 | } 159 | } 160 | 161 | //MARK:- UITapGestureRecognizer 162 | func handleTap(sender: UITapGestureRecognizer? = nil) { 163 | refCountryListView?.removeFromSuperview() 164 | refCountryListView = nil 165 | } 166 | 167 | func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool { 168 | if (touch.view?.isDescendant(of: (refCountryListView?.viewList)!))! { 169 | return false 170 | } 171 | else{ 172 | return true 173 | } 174 | } 175 | 176 | //MARK:- Add Contact To Device Contact 177 | func AddContact(){ 178 | if validationCheck() == true { 179 | let dicDetails = generateAllDetailDic() 180 | ContactHelper.objContactHelper.addContact(addDic: dicDetails, controller : self) 181 | } 182 | } 183 | 184 | func generateAllDetailDic() ->NSDictionary { 185 | let arrFullname: [String] = self.txtName.text!.trim().components(separatedBy: " ") 186 | let fullNo = btnCountryCode.currentTitle! + txtMobile.text! 187 | let emailId = txtEmailId.text!.trim() 188 | 189 | let dic: NSDictionary = ["Fullname": arrFullname , "Mobile": fullNo, "EmailID" : emailId] 190 | return dic 191 | } 192 | 193 | //MARK:- Update Contact To Device Contact 194 | func updateData() { 195 | if validationCheck() == true { 196 | let dicDetails = generateAllDetailDic() 197 | ContactHelper.objContactHelper.updateContact(addDic: dicDetails, contactModel: contactModel!, controller: self) 198 | } 199 | } 200 | 201 | //MARK:- ValidationCheck 202 | func validationCheck() -> Bool { 203 | if (txtName.text?.trim().isEmpty)! || txtName.text?.trim() == nil 204 | { 205 | alertShow(strMessage: "Please enter full name") 206 | return false 207 | } 208 | else if (txtName.text?.trim().characters.count)! > 0 { 209 | let arrFullname = txtName.text?.trim().components(separatedBy: " ") 210 | 211 | if (arrFullname?.count)! < 2 { 212 | alertShow(strMessage: "Please enter first and last name") 213 | return false 214 | } 215 | } 216 | 217 | if (txtMobile.text?.isEmpty)! || txtMobile.text == nil 218 | { 219 | alertShow(strMessage: "Please enter mobile number") 220 | return false 221 | } 222 | else if (txtMobile.text?.characters.count)! > 0 223 | { 224 | let checkmobile: Bool = myMobileNumberValidate(number: txtMobile.text!) 225 | if checkmobile == false { 226 | alertShow(strMessage: "Please enter valid mobile number") 227 | return false 228 | } 229 | } 230 | 231 | if (txtEmailId.text?.trim().characters.count)! > 0 && txtEmailId.text?.trim() != "" 232 | { 233 | let isValidEmail: Bool = appdelObj.emailAdrressValidation(strEmail: "\(txtEmailId.text!.trim())") 234 | 235 | if isValidEmail == true { 236 | return true 237 | } 238 | else{ 239 | alertShow(strMessage: "Please enter valid email") 240 | return false 241 | } 242 | } 243 | return true 244 | } 245 | func myMobileNumberValidate(number: String) -> Bool { 246 | let numberRegEx = "[0-9]{10,15}" 247 | let numberTest = NSPredicate(format:"SELF MATCHES %@", numberRegEx) 248 | if !numberTest.evaluate(with: number){ 249 | return false 250 | } 251 | return true 252 | } 253 | 254 | //MARK:- DelegateCountry Methods 255 | func selectedCountry (passstring: String, index: NSInteger){ 256 | print(passstring) 257 | print(index) 258 | refCountryListView?.removeFromSuperview() 259 | refCountryListView = nil 260 | btnCountryCode.setTitle(passstring, for: UIControlState.normal) 261 | } 262 | 263 | } 264 | 265 | //MARK:- UITextField Methods 266 | extension AddContactVC: UITextFieldDelegate 267 | { 268 | func textFieldDidBeginEditing(_ textField: UITextField) { 269 | activeTextField = textField 270 | } 271 | func textFieldDidEndEditing(_ textField: UITextField) { 272 | // activeTextField = nil 273 | } 274 | func textFieldShouldReturn(_ textField: UITextField) -> Bool { 275 | 276 | if textField == txtName { 277 | txtMobile.becomeFirstResponder() 278 | } 279 | else if textField == txtMobile{ 280 | txtEmailId.becomeFirstResponder() 281 | } 282 | else{ 283 | textField.resignFirstResponder() 284 | } 285 | return true 286 | } 287 | 288 | func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool 289 | { 290 | if textField == txtName 291 | { 292 | if string.isEmpty { 293 | return true 294 | } 295 | 296 | let regEx = "([a-zA-Z ])" 297 | let range = string.range(of:regEx, options:.regularExpression) 298 | if range != nil { 299 | let found = string.substring(with: range!) 300 | print("found: \(found)") // found: example 301 | 302 | } 303 | else{ 304 | return false 305 | } 306 | } 307 | 308 | else if textField == txtMobile 309 | { 310 | if string.isEmpty { 311 | return true 312 | } 313 | 314 | let aSet = NSCharacterSet(charactersIn:"0123456789").inverted 315 | let compSepByCharInSet = string.components(separatedBy: aSet) 316 | let numberFiltered = compSepByCharInSet.joined(separator: "") 317 | 318 | if numberFiltered == "" { 319 | return false 320 | } 321 | else 322 | { 323 | let currentString = (textField.text! as NSString) 324 | .replacingCharacters(in: range, with: string) 325 | 326 | let inteValue :Int? = Int(currentString) 327 | 328 | if inteValue! > 0 { 329 | let length = currentString.characters.count 330 | if length > 15 { 331 | return false 332 | } 333 | } 334 | else 335 | { 336 | return false 337 | } 338 | } 339 | } 340 | 341 | return true 342 | } 343 | } 344 | 345 | //MARK:- ContactFetchDelegate 346 | extension AddContactVC : ContactFetchDelegate { 347 | func contactAddedOrUpdateSuccess() { 348 | print("Contact added Successfully") 349 | // DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { 350 | // _ = self.navigationController?.popViewController(animated: true) 351 | // 352 | // } 353 | DispatchQueue.main.asyncAfter(deadline: .now()) { 354 | self.dismiss(animated: true, completion: nil) 355 | } 356 | } 357 | } 358 | 359 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // FetchContactListSwift3 4 | // 5 | // Created by piyush sinroja on 12/01/17. 6 | // Copyright © 2017 Piyush. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | let indicator = UIActivityIndicatorView(activityIndicatorStyle: .whiteLarge) 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // 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. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // 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. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | // MARK: - HUD Custom Method 45 | func showHUD(viewNew: UIView){ 46 | DispatchQueue.main.async { 47 | self.indicator.center = viewNew.center 48 | self.indicator.frame.origin.y = self.indicator.frame.origin.y - 64 49 | self.indicator.backgroundColor = UIColor.lightGray 50 | viewNew.addSubview(self.indicator) 51 | viewNew.bringSubview(toFront: self.indicator) 52 | self.indicator.startAnimating(isUserInteractionEnabled: false) 53 | } 54 | } 55 | 56 | func HideHud() { 57 | DispatchQueue.main.async { 58 | self.indicator.stopAnimating(isUserInteractionEnabled: true) 59 | } 60 | } 61 | 62 | //MARK emailAdrressValidation 63 | func emailAdrressValidation(strEmail : String)->Bool { 64 | // Password should not blank 65 | if strEmail.isEmpty{ 66 | return false 67 | } 68 | //Email address should accept like:test@gmail.co.uk 69 | let emailRegEx = "[.0-9a-zA-Z_-]+@[0-9a-zA-Z.-]+\\.[a-zA-Z]{2,20}" 70 | let emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx) 71 | 72 | if !emailTest.evaluate(with: strEmail){ 73 | return false 74 | } 75 | return true 76 | } 77 | } 78 | extension UIActivityIndicatorView { 79 | func startAnimating(isUserInteractionEnabled: Bool){ 80 | self.startAnimating() 81 | self.superview?.isUserInteractionEnabled = isUserInteractionEnabled 82 | } 83 | func stopAnimating(isUserInteractionEnabled: Bool){ 84 | self.stopAnimating() 85 | self.superview?.isUserInteractionEnabled = isUserInteractionEnabled 86 | } 87 | } 88 | 89 | extension UITextField{ 90 | func padding(width: CGFloat) { 91 | let label = UILabel(frame: CGRect(x :0,y :0,width :width,height: 10)) 92 | label.text = " " 93 | self.leftViewMode = .always 94 | self.leftView = label 95 | 96 | self.layer.cornerRadius = 5.0 97 | self.layer.borderColor = UIColor.lightGray.cgColor 98 | self.layer.borderWidth = 0.5 99 | } 100 | 101 | func cornerRadiusAndBorder() { 102 | self.layer.cornerRadius = 5.0 103 | self.layer.borderColor = UIColor.lightGray.cgColor 104 | self.layer.borderWidth = 0.5 105 | } 106 | } 107 | 108 | extension UIButton{ 109 | func cornerRadiusAndBorder() { 110 | self.layer.cornerRadius = 5.0 111 | self.layer.borderColor = UIColor.lightGray.cgColor 112 | self.layer.borderWidth = 0.5 113 | } 114 | } 115 | 116 | extension String 117 | { 118 | func trim() -> String { 119 | return self.trimmingCharacters(in: NSCharacterSet.whitespaces) 120 | } 121 | } 122 | 123 | extension UIViewController 124 | { 125 | //MARK:- Alert Function 126 | func alertShow(strMessage: String) { 127 | let alert = UIAlertController(title: "ContactDemoSwift3", message: strMessage, preferredStyle: UIAlertControllerStyle.alert) 128 | alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler:nil)) 129 | self.present(alert, animated: true, completion: nil) 130 | } 131 | } 132 | 133 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/add.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "add_referral.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "add_referral-1.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "add_referral-2.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/add.imageset/add_referral-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/add.imageset/add_referral-1.png -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/add.imageset/add_referral-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/add.imageset/add_referral-2.png -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/add.imageset/add_referral.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/add.imageset/add_referral.png -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/search.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "search.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "search-1.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "search-2.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/search.imageset/search-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/search.imageset/search-1.png -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/search.imageset/search-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/search.imageset/search-2.png -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/search.imageset/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/search.imageset/search.png -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/search_picker.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "search_picker.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "search_picker-1.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "search_picker-2.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/search_picker.imageset/search_picker-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/search_picker.imageset/search_picker-1.png -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/search_picker.imageset/search_picker-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/search_picker.imageset/search_picker-2.png -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/search_picker.imageset/search_picker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/search_picker.imageset/search_picker.png -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/tick.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "tick.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "tick-1.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "tick-2.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/tick.imageset/tick-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/tick.imageset/tick-1.png -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/tick.imageset/tick-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/tick.imageset/tick-2.png -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/tick.imageset/tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/FetchContactListSwift3/FetchContactListSwift3/Assets.xcassets/Images/tick.imageset/tick.png -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 46 | 52 | 58 | 67 | 74 | 80 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 131 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 287 | 298 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/ContactTableCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContactTableCell.swift 3 | // FetchContactListSwift3 4 | // 5 | // Created by piyush sinroja on 12/01/17. 6 | // Copyright © 2017 Piyush. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ContactTableCell: UITableViewCell { 12 | 13 | 14 | @IBOutlet weak var countryName: UILabel! 15 | @IBOutlet weak var btnAdd: UIButton! 16 | @IBOutlet weak var lblMobile: UILabel! 17 | @IBOutlet weak var lblName: UILabel! 18 | override func awakeFromNib() { 19 | super.awakeFromNib() 20 | // Initialization code 21 | } 22 | 23 | override func setSelected(_ selected: Bool, animated: Bool) { 24 | super.setSelected(selected, animated: animated) 25 | 26 | // Configure the view for the selected state 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/CountryCodes.json: -------------------------------------------------------------------------------- 1 | [ 2 | {"name":"Israel","dial_code":"+972","code":"IL"}, 3 | {"name":"Afghanistan","dial_code":"+93","code":"AF"}, 4 | {"name":"Albania","dial_code":"+355","code":"AL"}, 5 | {"name":"Algeria","dial_code":"+213","code":"DZ"}, 6 | {"name":"AmericanSamoa","dial_code":"+1 684","code":"AS"}, 7 | {"name":"Andorra","dial_code":"+376","code":"AD"}, 8 | {"name":"Angola","dial_code":"+244","code":"AO"}, 9 | {"name":"Anguilla","dial_code":"+1 264","code":"AI"}, 10 | {"name":"Antigua and Barbuda","dial_code":"+1 268","code":"AG"}, 11 | {"name":"Argentina","dial_code":"+54","code":"AR"}, 12 | {"name":"Armenia","dial_code":"+374","code":"AM"}, 13 | {"name":"Aruba","dial_code":"+297","code":"AW"}, 14 | {"name":"Australia","dial_code":"+61","code":"AU"}, 15 | {"name":"Austria","dial_code":"+43","code":"AT"}, 16 | {"name":"Azerbaijan","dial_code":"+994","code":"AZ"}, 17 | {"name":"Bahamas","dial_code":"+1 242","code":"BS"}, 18 | {"name":"Bahrain","dial_code":"+973","code":"BH"}, 19 | {"name":"Bangladesh","dial_code":"+880","code":"BD"}, 20 | {"name":"Barbados","dial_code":"+1 246","code":"BB"}, 21 | {"name":"Belarus","dial_code":"+375","code":"BY"}, 22 | {"name":"Belgium","dial_code":"+32","code":"BE"}, 23 | {"name":"Belize","dial_code":"+501","code":"BZ"}, 24 | {"name":"Benin","dial_code":"+229","code":"BJ"}, 25 | {"name":"Bermuda","dial_code":"+1 441","code":"BM"}, 26 | {"name":"Bhutan","dial_code":"+975","code":"BT"}, 27 | {"name":"Bosnia and Herzegovina","dial_code":"+387","code":"BA"}, 28 | {"name":"Botswana","dial_code":"+267","code":"BW"}, 29 | {"name":"Brazil","dial_code":"+55","code":"BR"}, 30 | {"name":"British Indian Ocean Territory","dial_code":"+246","code":"IO"}, 31 | {"name":"British Virgin Islands","dial_code":"+1 284","code":"VG"}, 32 | {"name":"Bulgaria","dial_code":"+359","code":"BG"}, 33 | {"name":"Burkina Faso","dial_code":"+226","code":"BF"}, 34 | {"name":"Burundi","dial_code":"+257","code":"BI"}, 35 | {"name":"Cambodia","dial_code":"+855","code":"KH"}, 36 | {"name":"Cameroon","dial_code":"+237","code":"CM"}, 37 | {"name":"Canada","dial_code":"+1","code":"CA"}, 38 | {"name":"Cape Verde","dial_code":"+238","code":"CV"}, 39 | {"name":"Cayman Islands","dial_code":"+1 345","code":"KY"}, 40 | {"name":"Central African Republic","dial_code":"+236","code":"CF"}, 41 | {"name":"Chad","dial_code":"+235","code":"TD"}, 42 | {"name":"Chile","dial_code":"+56","code":"CL"}, 43 | {"name":"China","dial_code":"+86","code":"CN"}, 44 | {"name":"Christmas Island","dial_code":"+61","code":"CX"}, 45 | {"name":"Cocos Islands","dial_code":"+61","code":"CC"}, 46 | {"name":"Colombia","dial_code":"+57","code":"CO"}, 47 | {"name":"Comoros","dial_code":"+269","code":"KM"}, 48 | {"name":"Congo","dial_code":"+242","code":"CG"}, 49 | {"name":"Cook Islands","dial_code":"+682","code":"CK"}, 50 | {"name":"Costa Rica","dial_code":"+506","code":"CR"}, 51 | {"name":"Croatia","dial_code":"+385","code":"HR"}, 52 | {"name":"Cuba","dial_code":"+53","code":"CU"}, 53 | {"name":"Curacao","dial_code":"+599","code":"CW"}, 54 | {"name":"Cyprus","dial_code":"+357","code":"CY"}, 55 | {"name":"Czech Republic","dial_code":"+420","code":"CZ"}, 56 | {"name":"Democratic Republic of the Congo","dial_code":"+243","code":"CD"}, 57 | {"name":"Denmark","dial_code":"+45","code":"DK"}, 58 | {"name":"Djibouti","dial_code":"+253","code":"DJ"}, 59 | {"name":"Dominica","dial_code":"+1 767","code":"DM"}, 60 | {"name":"Dominican Republic","dial_code":"+1 849","code":"DO"}, 61 | {"name":"East Timor","dial_code":"+670","code":"TL"}, 62 | {"name":"Ecuador","dial_code":"+593","code":"EC"}, 63 | {"name":"Egypt","dial_code":"+20","code":"EG"}, 64 | {"name":"El Salvador","dial_code":"+503","code":"SV"}, 65 | {"name":"Equatorial Guinea","dial_code":"+240","code":"GQ"}, 66 | {"name":"Eritrea","dial_code":"+291","code":"ER"}, 67 | {"name":"Estonia","dial_code":"+372","code":"EE"}, 68 | {"name":"Ethiopia","dial_code":"+251","code":"ET"}, 69 | {"name":"Faroe Islands","dial_code":"+298","code":"FO"}, 70 | {"name":"Fiji","dial_code":"+679","code":"FJ"}, 71 | {"name":"Finland","dial_code":"+358","code":"FI"}, 72 | {"name":"France","dial_code":"+33","code":"FR"}, 73 | {"name":"French Guiana","dial_code":"+594","code":"GF"}, 74 | {"name":"French Polynesia","dial_code":"+689","code":"PF"}, 75 | {"name":"Gabon","dial_code":"+241","code":"GA"}, 76 | {"name":"Gambia","dial_code":"+220","code":"GM"}, 77 | {"name":"Georgia","dial_code":"+995","code":"GE"}, 78 | {"name":"Germany","dial_code":"+49","code":"DE"}, 79 | {"name":"Ghana","dial_code":"+233","code":"GH"}, 80 | {"name":"Gibraltar","dial_code":"+350","code":"GI"}, 81 | {"name":"Greece","dial_code":"+30","code":"GR"}, 82 | {"name":"Greenland","dial_code":"+299","code":"GL"}, 83 | {"name":"Grenada","dial_code":"+1 473","code":"GD"}, 84 | {"name":"Guadeloupe","dial_code":"+590","code":"GP"}, 85 | {"name":"Guam","dial_code":"+1 671","code":"GU"}, 86 | {"name":"Guatemala","dial_code":"+502","code":"GT"}, 87 | {"name":"Guinea","dial_code":"+224","code":"GN"}, 88 | {"name":"Guinea-Bissau","dial_code":"+245","code":"GW"}, 89 | {"name":"Guyana","dial_code":"+592","code":"GY"}, 90 | {"name":"Haiti","dial_code":"+509","code":"HT"}, 91 | {"name":"Honduras","dial_code":"+504","code":"HN"}, 92 | {"name":"Hungary","dial_code":"+36","code":"HU"}, 93 | {"name":"Iceland","dial_code":"+354","code":"IS"}, 94 | {"name":"India","dial_code":"+91","code":"IN"}, 95 | {"name":"Indonesia","dial_code":"+62","code":"ID"}, 96 | {"name":"Iraq","dial_code":"+964","code":"IQ"}, 97 | {"name":"Ireland","dial_code":"+353","code":"IE"}, 98 | {"name":"Israel","dial_code":"+972","code":"IL"}, 99 | {"name":"Italy","dial_code":"+39","code":"IT"}, 100 | {"name":"Ivory Coast","dial_code":"+225","code":"CI"}, 101 | {"name":"Jamaica","dial_code":"+1 876","code":"JM"}, 102 | {"name":"Japan","dial_code":"+81","code":"JP"}, 103 | {"name":"Jordan","dial_code":"+962","code":"JO"}, 104 | {"name":"Kazakhstan","dial_code":"+7","code":"KZ"}, 105 | {"name":"Kenya","dial_code":"+254","code":"KE"}, 106 | {"name":"Kiribati","dial_code":"+686","code":"KI"}, 107 | {"name":"Kosovo","dial_code":"+383","code":"XK"}, 108 | {"name":"Kuwait","dial_code":"+965","code":"KW"}, 109 | {"name":"Kyrgyzstan","dial_code":"+996","code":"KG"}, 110 | {"name":"Laos","dial_code":"+856","code":"LA"}, 111 | {"name":"Latvia","dial_code":"+371","code":"LV"}, 112 | {"name":"Lebanon","dial_code":"+961","code":"LB"}, 113 | {"name":"Lesotho","dial_code":"+266","code":"LS"}, 114 | {"name":"Liberia","dial_code":"+231","code":"LR"}, 115 | {"name":"Liechtenstein","dial_code":"+423","code":"LI"}, 116 | {"name":"Lithuania","dial_code":"+370","code":"LT"}, 117 | {"name":"Luxembourg","dial_code":"+352","code":"LU"}, 118 | {"name":"Madagascar","dial_code":"+261","code":"MG"}, 119 | {"name":"Malawi","dial_code":"+265","code":"MW"}, 120 | {"name":"Malaysia","dial_code":"+60","code":"MY"}, 121 | {"name":"Maldives","dial_code":"+960","code":"MV"}, 122 | {"name":"Mali","dial_code":"+223","code":"ML"}, 123 | {"name":"Malta","dial_code":"+356","code":"MT"}, 124 | {"name":"Marshall Islands","dial_code":"+692","code":"MH"}, 125 | {"name":"Martinique","dial_code":"+596","code":"MQ"}, 126 | {"name":"Mauritania","dial_code":"+222","code":"MR"}, 127 | {"name":"Mauritius","dial_code":"+230","code":"MU"}, 128 | {"name":"Mayotte","dial_code":"+262","code":"YT"}, 129 | {"name":"Mexico","dial_code":"+52","code":"MX"}, 130 | {"name":"Monaco","dial_code":"+377","code":"MC"}, 131 | {"name":"Mongolia","dial_code":"+976","code":"MN"}, 132 | {"name":"Montenegro","dial_code":"+382","code":"ME"}, 133 | {"name":"Montserrat","dial_code":"+1 664","code":"MS"}, 134 | {"name":"Morocco","dial_code":"+212","code":"MA"}, 135 | {"name":"Myanmar","dial_code":"+95","code":"MM"}, 136 | {"name":"Namibia","dial_code":"+264","code":"NA"}, 137 | {"name":"Nauru","dial_code":"+674","code":"NR"}, 138 | {"name":"Nepal","dial_code":"+977","code":"NP"}, 139 | {"name":"Netherlands","dial_code":"+31","code":"NL"}, 140 | {"name":"Netherlands Antilles","dial_code":"+599","code":"AN"}, 141 | {"name":"New Caledonia","dial_code":"+687","code":"NC"}, 142 | {"name":"New Zealand","dial_code":"+64","code":"NZ"}, 143 | {"name":"Nicaragua","dial_code":"+505","code":"NI"}, 144 | {"name":"Niger","dial_code":"+227","code":"NE"}, 145 | {"name":"Nigeria","dial_code":"+234","code":"NG"}, 146 | {"name":"Niue","dial_code":"+683","code":"NU"}, 147 | {"name":"North Korea","dial_code":"+850","code":"KP"}, 148 | {"name":"Norfolk Island","dial_code":"+672","code":"NF"}, 149 | {"name":"Northern Mariana Islands","dial_code":"+1 670","code":"MP"}, 150 | {"name":"Norway","dial_code":"+47","code":"NO"}, 151 | {"name":"Oman","dial_code":"+968","code":"OM"}, 152 | {"name":"Pakistan","dial_code":"+92","code":"PK"}, 153 | {"name":"Palau","dial_code":"+680","code":"PW"}, 154 | {"name":"Palestine","dial_code":"+970","code":"PS"}, 155 | {"name":"Panama","dial_code":"+507","code":"PA"}, 156 | {"name":"Papua New Guinea","dial_code":"+675","code":"PG"}, 157 | {"name":"Paraguay","dial_code":"+595","code":"PY"}, 158 | {"name":"Peru","dial_code":"+51","code":"PE"}, 159 | {"name":"Philippines","dial_code":"+63","code":"PH"}, 160 | {"name":"Poland","dial_code":"+48","code":"PL"}, 161 | {"name":"Portugal","dial_code":"+351","code":"PT"}, 162 | {"name":"Puerto Rico","dial_code":"+1 939","code":"PR"}, 163 | {"name":"Qatar","dial_code":"+974","code":"QA"}, 164 | {"name":"Republic of the Congo","dial_code":"+242","code":"CG"}, 165 | {"name":"Reunion","dial_code":"+262","code":"RE"}, 166 | {"name":"Romania","dial_code":"+40","code":"RO"}, 167 | {"name":"Rwanda","dial_code":"+250","code":"RW"}, 168 | {"name":"Saint Barthelemy","dial_code":"+590","code":"BL"}, 169 | {"name":"Samoa","dial_code":"+685","code":"WS"}, 170 | {"name":"San Marino","dial_code":"+378","code":"SM"}, 171 | {"name":"Saudi Arabia","dial_code":"+966","code":"SA"}, 172 | {"name":"Senegal","dial_code":"+221","code":"SN"}, 173 | {"name":"Serbia","dial_code":"+381","code":"RS"}, 174 | {"name":"Seychelles","dial_code":"+248","code":"SC"}, 175 | {"name":"Sierra Leone","dial_code":"+232","code":"SL"}, 176 | {"name":"Singapore","dial_code":"+65","code":"SG"}, 177 | {"name":"Sint Maarten","dial_code":"+1 721","code":"SX"}, 178 | {"name":"Slovakia","dial_code":"+421","code":"SK"}, 179 | {"name":"Slovenia","dial_code":"+386","code":"SI"}, 180 | {"name":"Solomon Islands","dial_code":"+677","code":"SB"}, 181 | {"name":"South Africa","dial_code":"+27","code":"ZA"}, 182 | {"name":"South Korea","dial_code":"+82","code":"KR"}, 183 | {"name":"South Sudan","dial_code":"+211","code":"SS"}, 184 | {"name":"South Georgia and the South Sandwich Islands","dial_code":"+500","code":"GS"}, 185 | {"name":"Spain","dial_code":"+34","code":"ES"}, 186 | {"name":"Sri Lanka","dial_code":"+94","code":"LK"}, 187 | {"name":"Sudan","dial_code":"+249","code":"SD"}, 188 | {"name":"Suriname","dial_code":"+597","code":"SR"}, 189 | {"name":"Swaziland","dial_code":"+268","code":"SZ"}, 190 | {"name":"Sweden","dial_code":"+46","code":"SE"}, 191 | {"name":"Switzerland","dial_code":"+41","code":"CH"}, 192 | {"name":"Tajikistan","dial_code":"+992","code":"TJ"}, 193 | {"name":"Thailand","dial_code":"+66","code":"TH"}, 194 | {"name":"Togo","dial_code":"+228","code":"TG"}, 195 | {"name":"Tokelau","dial_code":"+690","code":"TK"}, 196 | {"name":"Tonga","dial_code":"+676","code":"TO"}, 197 | {"name":"Trinidad and Tobago","dial_code":"+1 868","code":"TT"}, 198 | {"name":"Tunisia","dial_code":"+216","code":"TN"}, 199 | {"name":"Turkey","dial_code":"+90","code":"TR"}, 200 | {"name":"Turkmenistan","dial_code":"+993","code":"TM"}, 201 | {"name":"Turks and Caicos Islands","dial_code":"+1 649","code":"TC"}, 202 | {"name":"Tuvalu","dial_code":"+688","code":"TV"}, 203 | {"name":"U.S. Virgin Islands","dial_code":"+1 340","code":"VI"}, 204 | {"name":"Uganda","dial_code":"+256","code":"UG"}, 205 | {"name":"Ukraine","dial_code":"+380","code":"UA"}, 206 | {"name":"United Arab Emirates","dial_code":"+971","code":"AE"}, 207 | {"name":"United Kingdom","dial_code":"+44","code":"GB"}, 208 | {"name":"United States","dial_code":"+1","code":"US"}, 209 | {"name":"Uruguay","dial_code":"+598","code":"UY"}, 210 | {"name":"Uzbekistan","dial_code":"+998","code":"UZ"}, 211 | {"name":"Vanuatu","dial_code":"+678","code":"VU"}, 212 | {"name":"Wallis and Futuna","dial_code":"+681","code":"WF"}, 213 | {"name":"Western Sahara","dial_code":"212","code":"EH"}, 214 | {"name":"Yemen","dial_code":"+967","code":"YE"}, 215 | {"name":"Zambia","dial_code":"+260","code":"ZM"}, 216 | {"name":"Zimbabwe","dial_code":"+263","code":"ZW"}, 217 | {"name":"Åland Islands","dial_code":"+358","code":"AX"}, 218 | {"name":"Antarctica","dial_code":"+672","code":"AQ"}, 219 | {"name":"Bolivia","dial_code":"+591","code":"BO"}, 220 | {"name":"Brunei Darussalam","dial_code":"+673","code":"BN"}, 221 | {"name":"Cocos (Keeling) Islands","dial_code":"+61","code":"CC"}, 222 | {"name":"Congo, The Democratic Republic of the","dial_code":"+243","code":"CD"}, 223 | {"name":"Cote d'Ivoire","dial_code":"+225","code":"CI"}, 224 | {"name":"Falkland Islands (Malvinas)","dial_code":"+500","code":"FK"}, 225 | {"name":"Guernsey","dial_code":"+44","code":"GG"}, 226 | {"name":"Holy See (Vatican City State)","dial_code":"+379","code":"VA"}, 227 | {"name":"Hong Kong","dial_code":"+852","code":"HK"}, 228 | {"name":"Iran, Islamic Republic of","dial_code":"+98","code":"IR"}, 229 | {"name":"Isle of Man","dial_code":"+44","code":"IM"}, 230 | {"name":"Jersey","dial_code":"+44","code":"JE"}, 231 | {"name":"Korea, Democratic People's Republic of","dial_code":"+850","code":"KP"}, 232 | {"name":"Korea, Republic of","dial_code":"+82","code":"KR"}, 233 | {"name":"Lao People's Democratic Republic","dial_code":"+856","code":"LA"}, 234 | {"name":"Libya","dial_code":"+218","code":"LY"}, 235 | {"name":"Macau","dial_code":"+853","code":"MO"}, 236 | {"name":"Macedonia","dial_code":"+389","code":"MK"}, 237 | {"name":"Micronesia, Federated States of","dial_code":"+691","code":"FM"}, 238 | {"name":"Moldova","dial_code":"+373","code":"MD"}, 239 | {"name":"Mozambique","dial_code":"+258","code":"MZ"}, 240 | {"name":"Palestinian Territory, Occupied","dial_code":"+970","code":"PS"}, 241 | {"name":"Pitcairn","dial_code":"+64","code":"PN"}, 242 | {"name":"Réunion","dial_code":"+262","code":"RE"}, 243 | {"name":"Russia","dial_code":"+7","code":"RU"}, 244 | {"name":"Saint Barthélemy","dial_code":"+590","code":"BL"}, 245 | {"name":"Saint Helena, Ascension and Tristan Da Cunha","dial_code":"+290","code":"SH"}, 246 | {"name":"Saint Kitts and Nevis","dial_code":"+1 869","code":"KN"}, 247 | {"name":"Saint Lucia","dial_code":"+1 758","code":"LC"}, 248 | {"name":"Saint Martin","dial_code":"+590","code":"MF"}, 249 | {"name":"Saint Pierre and Miquelon","dial_code":"+508","code":"PM"}, 250 | {"name":"Saint Vincent and the Grenadines","dial_code":"+1 784","code":"VC"}, 251 | {"name":"Sao Tome and Principe","dial_code":"+239","code":"ST"}, 252 | {"name":"Somalia","dial_code":"+252","code":"SO"}, 253 | {"name":"Svalbard and Jan Mayen","dial_code":"+47","code":"SJ"}, 254 | {"name":"Syrian Arab Republic","dial_code":"+963","code":"SY"}, 255 | {"name":"Taiwan, Province of China","dial_code":"+886","code":"TW"}, 256 | {"name":"Tanzania, United Republic of","dial_code":"+255","code":"TZ"}, 257 | {"name":"Timor-Leste","dial_code":"+670","code":"TL"}, 258 | {"name":"Venezuela, Bolivarian Republic of","dial_code":"+58","code":"VE"}, 259 | {"name":"Vietnam","dial_code":"+84","code":"VN"}, 260 | {"name":"Virgin Islands, British","dial_code":"+1 284","code":"VG"}, 261 | {"name":"Virgin Islands, U.S.","dial_code":"+1 340","code":"VI"}] 262 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/CountryListPopUpView/CountryListPopUpView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CountryListPopUpView.swift 3 | // ARDWM_Client 4 | // 5 | // Created by piyush sinroja on 24/11/16. 6 | // Copyright © 2017 Piyush. All rights reserved. 7 | 8 | import UIKit 9 | 10 | @objc protocol delegateCountry{ 11 | func selectedCountry (passstring: String, index: NSInteger) 12 | } 13 | class CountryListPopUpView: UIView,UITableViewDataSource, UITableViewDelegate, UITextFieldDelegate { 14 | 15 | var delegate: delegateCountry? 16 | var strSearch : NSString = NSString() 17 | var arrtempList : NSArray = NSArray() 18 | 19 | //MARK:- UITableView IBOutlet 20 | @IBOutlet weak var tblCountryList: UITableView! 21 | 22 | //MARK:- UITextField IBOutlet 23 | @IBOutlet weak var txtCountrySearch: UITextField! 24 | 25 | //MARK:- UIView IBOutlet 26 | @IBOutlet weak var viewList: UIView! 27 | 28 | //MARK:- Other Var 29 | var arrCountryList : NSArray = NSArray() 30 | var objCountryListCell: CountryListTableCell = CountryListTableCell() 31 | 32 | //MARK:- SetupCountryView 33 | func SetupCountryView() { 34 | tblCountryList.register(UINib(nibName: "CountryListTableCell", bundle: nil), forCellReuseIdentifier: "CountryListTableCell") 35 | 36 | tblCountryList.estimatedRowHeight = 44 37 | tblCountryList.rowHeight = UITableViewAutomaticDimension 38 | viewList.layer.cornerRadius = 5.0 39 | viewList.layer.borderWidth = 1.0 40 | viewList.layer.borderColor = UIColor.lightGray.cgColor 41 | viewList.layer.masksToBounds = true 42 | 43 | let filePath = Bundle.main.path(forResource: "CountryCodes", ofType: "json")! 44 | if let countyData: NSData = NSData(contentsOfFile: filePath) { 45 | do { 46 | let jsonResult = try JSONSerialization.jsonObject(with: countyData as Data, options: JSONSerialization.ReadingOptions.mutableContainers) as! NSMutableArray 47 | 48 | print(jsonResult) 49 | let sortByName = NSSortDescriptor(key: "name", ascending: true) 50 | let sortDescriptors = [sortByName] 51 | let sortedArray : NSArray = (jsonResult as NSMutableArray).sortedArray(using: 52 | sortDescriptors) as NSArray 53 | 54 | print(sortedArray) 55 | 56 | arrCountryList = sortedArray 57 | 58 | } catch { 59 | print("JSON Processing Failed") 60 | } 61 | } 62 | arrtempList = arrCountryList.mutableCopy() as! NSArray 63 | } 64 | 65 | //MARK:- UITableView Methods 66 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 67 | return arrCountryList.count 68 | } 69 | 70 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 71 | return UITableViewAutomaticDimension 72 | } 73 | 74 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 75 | 76 | objCountryListCell = tableView.dequeueReusableCell(withIdentifier: "CountryListTableCell") as! CountryListTableCell 77 | 78 | let dic : NSDictionary = arrCountryList[indexPath.row] as! NSDictionary 79 | objCountryListCell.countryName.text = dic.object(forKey: "name") as! String? 80 | 81 | if (dic.object(forKey: "dial_code") == nil) || (dic.object(forKey: "dial_code") is NSNull ){ 82 | 83 | } 84 | else{ 85 | 86 | let dialcode = dic.object(forKey: "dial_code") as! String? 87 | let newdialcode = dialcode?.replacingOccurrences(of: " ", with: "-") 88 | objCountryListCell.countryCode.text = newdialcode 89 | } 90 | 91 | objCountryListCell.backgroundColor = UIColor.clear 92 | objCountryListCell.selectionStyle = UITableViewCellSelectionStyle.none 93 | return objCountryListCell 94 | } 95 | 96 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 97 | print(indexPath.row) 98 | // dismiss(animated: false, completion: nil) 99 | tableView.deselectRow(at: indexPath, animated: false) 100 | 101 | 102 | let dic : NSDictionary = arrCountryList[indexPath.row] as! NSDictionary 103 | objCountryListCell.countryName.text = dic.object(forKey: "name") as! String? 104 | 105 | if (dic.object(forKey: "dial_code") == nil) || (dic.object(forKey: "dial_code") is NSNull ){ 106 | 107 | } 108 | else{ 109 | delegate?.selectedCountry(passstring: (dic.object(forKey: "dial_code") as! String?)! , index : indexPath.row) 110 | } 111 | } 112 | 113 | //MARK:- UITextField Methods 114 | func textFieldDidBeginEditing(_ textField: UITextField) { 115 | // txtCountrySearch.text = "" 116 | } 117 | func textFieldShouldReturn(_ textField: UITextField) -> Bool { 118 | textField.resignFirstResponder() 119 | return true 120 | } 121 | func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { 122 | 123 | let currentString = (textField.text! as NSString) 124 | .replacingCharacters(in: range, with: string) 125 | 126 | strSearch = String(format: "%@", currentString) as NSString 127 | 128 | if textField == txtCountrySearch { 129 | updatedCountryResults(NormalListArr: arrtempList as! NSMutableArray, strKey: "name") 130 | } 131 | 132 | return true 133 | } 134 | 135 | //MARK:- Search Update 136 | func updatedCountryResults(NormalListArr: NSMutableArray, strKey: NSString) { 137 | 138 | var filteredListarr: NSMutableArray? 139 | filteredListarr = nil 140 | 141 | filteredListarr = NSMutableArray.init(array: NormalListArr) 142 | 143 | let predicate: NSPredicate? 144 | 145 | if strKey.length > 0 { 146 | predicate = NSPredicate(format: "%K BEGINSWITH[cd]%@", strKey, "\(strSearch)") 147 | } 148 | else { 149 | predicate = NSPredicate(format: "self BEGINSWITH[cd] %@", "\(strSearch)") 150 | } 151 | 152 | filteredListarr?.filter(using: predicate!) 153 | 154 | if strSearch.length == 0 { 155 | updateTableView(filteredarr: NormalListArr) 156 | } 157 | else{ 158 | updateTableView(filteredarr: filteredListarr!) 159 | } 160 | } 161 | 162 | func updateTableView(filteredarr: NSMutableArray) { 163 | if filteredarr.count > 0 { 164 | self.tblCountryList.isHidden = false 165 | self.arrCountryList = filteredarr 166 | self.tblCountryList.reloadData() 167 | } 168 | else { 169 | self.tblCountryList.isHidden = true 170 | } 171 | } 172 | 173 | } 174 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/CountryListPopUpView/CountryListPopUpView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | MuseoSans-300 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/CountryListPopUpView/CountryListTableCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CountryListTableCell.swift 3 | // ARDWM_Client 4 | // 5 | // Created by piyush sinroja on 24/11/16. 6 | // Copyright © 2017 Piyush. All rights reserved. 7 | 8 | import UIKit 9 | class CountryListTableCell: UITableViewCell { 10 | 11 | 12 | @IBOutlet weak var countryName: UILabel! 13 | 14 | @IBOutlet weak var countryCode: UILabel! 15 | 16 | override func awakeFromNib() { 17 | super.awakeFromNib() 18 | // Initialization code 19 | } 20 | 21 | override func setSelected(_ selected: Bool, animated: Bool) { 22 | super.setSelected(selected, animated: animated) 23 | 24 | // Configure the view for the selected state 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/CountryListPopUpView/CountryListTableCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | MuseoSans-300 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 31 | 37 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | NSContactsUsageDescription 45 | ContactListSwift3 46 | 47 | 48 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // FetchContactListSwift3 4 | // 5 | // Created by piyush sinroja on 12/01/17. 6 | // Copyright © 2017 Piyush. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Contacts 11 | import ContactsUI 12 | 13 | class ViewController: UIViewController { 14 | 15 | let appdelObj: AppDelegate = UIApplication.shared.delegate as! AppDelegate 16 | 17 | //UITableView Outlet 18 | @IBOutlet weak var tblAddReferral: UITableView! 19 | 20 | //MARK:- UITextField IBOutlet 21 | @IBOutlet weak var txtSearch: UITextField! 22 | 23 | var strSearch : NSString = NSString() 24 | var arrtempList : NSArray = NSArray() 25 | var arrContactList : NSMutableArray = NSMutableArray() 26 | 27 | //MARK:- ViewDidLoad 28 | override func viewDidLoad() { 29 | super.viewDidLoad() 30 | // Do any additional setup after loading the view, typically from a nib. 31 | 32 | tblAddReferral.contentInset = UIEdgeInsetsMake(0, 0, 0, 0); //values 33 | tblAddReferral.estimatedRowHeight = 110 34 | tblAddReferral.rowHeight = UITableViewAutomaticDimension 35 | 36 | txtSearch.padding(width: 22) 37 | txtSearch.cornerRadiusAndBorder() 38 | } 39 | 40 | override func viewWillAppear(_ animated: Bool) { 41 | super.viewWillAppear(true) 42 | 43 | ContactHelper.objContactHelper.delegateContact = self 44 | 45 | //------------------------FetchContact---------------/// 46 | fetchContactDetails() 47 | //------------------------------------------------// 48 | } 49 | 50 | //MARK:- FetchContactDetails 51 | func fetchContactDetails() { 52 | ContactHelper.objContactHelper.getContactList(controller: self) 53 | } 54 | 55 | //MARK:- Search Update 56 | func searchFunction(textField: UITextField){ 57 | if textField == txtSearch { 58 | if arrtempList.count > 0 { 59 | updatedResults(NormalListArr: arrtempList as! NSMutableArray, strKey: "fullname") 60 | } 61 | } 62 | } 63 | 64 | func updatedResults(NormalListArr: NSMutableArray, strKey: NSString) { 65 | var filteredListarr: NSMutableArray? 66 | filteredListarr = nil 67 | filteredListarr = NSMutableArray.init(array: NormalListArr) 68 | let predicate: NSPredicate? 69 | // if strKey.length > 0 { 70 | // predicate = NSPredicate(format: "%K BEGINSWITH[cd]%@", strKey, "\(strSearch)") 71 | // } else { 72 | // predicate = NSPredicate(format: "self BEGINSWITH[cd] %@", "\(strSearch)") 73 | // } 74 | 75 | if strKey.length > 0 { 76 | predicate = NSPredicate(format: "%K contains[c]%@", strKey, "\(strSearch)") 77 | } else { 78 | predicate = NSPredicate(format: "self contains[c] %@", "\(strSearch)") 79 | } 80 | 81 | filteredListarr?.filter(using: predicate!) 82 | if strSearch.length == 0 { 83 | updateContactListTableView(filteredarr: NormalListArr) 84 | } else { 85 | updateContactListTableView(filteredarr: filteredListarr!) 86 | } 87 | } 88 | 89 | func updateContactListTableView(filteredarr: NSMutableArray) { 90 | if filteredarr.count > 0 { 91 | tblAddReferral.isHidden = false 92 | arrContactList = filteredarr 93 | tblAddReferral.reloadData() 94 | } else { 95 | tblAddReferral.isHidden = true 96 | } 97 | } 98 | 99 | //MARK:- Cell UIButton Actions 100 | func btnAddInCell(sender: UIButton) { 101 | print(sender.tag) 102 | let dic: NSDictionary = arrContactList[sender.tag] as! NSDictionary 103 | let strCheck = dic.object(forKey: "isadded") as! String 104 | 105 | if strCheck == "0" { 106 | dic.setValue("1", forKey: "isadded") 107 | arrContactList.replaceObject(at: sender.tag, with: dic) 108 | } 109 | else{ 110 | dic.setValue("0", forKey: "isadded") 111 | arrContactList.replaceObject(at: sender.tag, with: dic) 112 | } 113 | 114 | DispatchQueue.main.async(execute: { () -> Void in 115 | let indexpath: NSIndexPath = NSIndexPath(row: sender.tag, section: 0) 116 | self.tblAddReferral.reloadRows(at: [indexpath as IndexPath], with: UITableViewRowAnimation.none) 117 | }) 118 | } 119 | 120 | @IBAction func btnAdd(_ sender: Any) { 121 | txtSearch.resignFirstResponder() 122 | let addContactVCobj = self.storyboard?.instantiateViewController(withIdentifier: "AddContactVC") as? AddContactVC 123 | self.present(addContactVCobj!, animated: true, completion: nil) 124 | } 125 | 126 | override func didReceiveMemoryWarning() { 127 | super.didReceiveMemoryWarning() 128 | // Dispose of any resources that can be recreated. 129 | } 130 | } 131 | 132 | //MARK:- UITextField Methods 133 | extension ViewController: UITextFieldDelegate 134 | { 135 | func textFieldDidBeginEditing(_ textField: UITextField) { 136 | if strSearch == "" { 137 | txtSearch.text = "" 138 | } else { 139 | txtSearch.text = strSearch as String 140 | } 141 | searchFunction(textField: textField) 142 | } 143 | 144 | func textFieldShouldReturn(_ textField: UITextField) -> Bool { 145 | textField.resignFirstResponder() 146 | return true 147 | } 148 | 149 | func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { 150 | let currentString = (textField.text! as NSString) 151 | .replacingCharacters(in: range, with: string) 152 | strSearch = String(format: "%@", currentString) as NSString 153 | searchFunction(textField: textField) 154 | return true 155 | } 156 | } 157 | 158 | //MARK:- UITableViewDataSource Methods 159 | extension ViewController: UITableViewDataSource { 160 | func numberOfSections(in tableView: UITableView) -> Int{ 161 | return 1 162 | } 163 | 164 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 165 | return arrContactList.count 166 | } 167 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 168 | let Cell = tableView.dequeueReusableCell(withIdentifier: "cell") as! ContactTableCell 169 | 170 | let dic: NSDictionary = arrContactList[indexPath.row] as! NSDictionary 171 | 172 | let btnadd: UIButton = Cell.btnAdd 173 | btnadd.tag = indexPath.row 174 | btnadd.addTarget(self, action: #selector(self.btnAddInCell), for: .touchUpInside) 175 | 176 | let name = dic.object(forKey: "fullname") as! String? 177 | let mobile = dic.object(forKey: "mobile") as! String? 178 | let isdcode = dic.object(forKey: "isdcode") as! String? 179 | let countryName = dic.object(forKey: "countryName") as! String? 180 | 181 | Cell.lblName.text = name 182 | Cell.countryName.text = countryName 183 | 184 | var newString = "" 185 | if (mobile?.hasPrefix(isdcode!))! { 186 | let strremain = mobile?.substring(from: (mobile?.index((mobile?.startIndex)!, offsetBy: (isdcode?.characters.count)!))!) 187 | 188 | newString = strremain! 189 | } 190 | else{ 191 | newString = mobile! 192 | } 193 | 194 | if isdcode == "" { 195 | Cell.lblMobile.text = newString 196 | } 197 | else{ 198 | Cell.lblMobile.text = isdcode! + "-" + newString 199 | } 200 | 201 | Cell.backgroundColor = UIColor.clear 202 | Cell.selectionStyle = UITableViewCellSelectionStyle.none 203 | return Cell 204 | } 205 | } 206 | 207 | //MARK:- UITableViewDelegate Methods 208 | extension ViewController: UITableViewDelegate { 209 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 210 | return UITableViewAutomaticDimension 211 | } 212 | 213 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 214 | //txtSearch.resignFirstResponder() 215 | let addContactVCobj = self.storyboard?.instantiateViewController(withIdentifier: "AddContactVC") as? AddContactVC 216 | 217 | let dic: NSDictionary = arrContactList[indexPath.row] as! NSDictionary 218 | let cModel = dic.object(forKey: "contactModel") as! CNContact? 219 | addContactVCobj?.contactModel = cModel 220 | addContactVCobj?.dicData = dic 221 | 222 | DispatchQueue.main.async { 223 | self.present(addContactVCobj!, animated: true, completion: nil) 224 | } 225 | } 226 | 227 | func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { 228 | return true 229 | } 230 | 231 | func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) { 232 | if (editingStyle == .delete) { 233 | print(indexPath.row) 234 | if let dicData: NSDictionary = arrContactList[indexPath.row] as? NSDictionary{ 235 | ContactHelper.objContactHelper.deleteContact(dicdata: dicData, controller: self) 236 | } 237 | } 238 | } 239 | } 240 | 241 | //MARK:- ContactFetchDelegate 242 | extension ViewController: ContactFetchDelegate 243 | { 244 | func updateDetails(indexpathValue: IndexPath){ 245 | self.tblAddReferral.reloadRows(at: [indexpathValue], with: UITableViewRowAnimation.automatic) 246 | } 247 | 248 | func allContactList(array: NSArray){ 249 | print(array) 250 | DispatchQueue.main.async { 251 | self.arrContactList = array.mutableCopy() as! NSMutableArray 252 | self.arrtempList = array 253 | print(self.arrtempList) 254 | self.tblAddReferral.reloadData() 255 | } 256 | } 257 | } 258 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3Tests/FetchContactListSwift3Tests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FetchContactListSwift3Tests.swift 3 | // FetchContactListSwift3Tests 4 | // 5 | // Created by piyush sinroja on 12/01/17. 6 | // Copyright © 2017 Piyush. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import FetchContactListSwift3 11 | 12 | class FetchContactListSwift3Tests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3UITests/FetchContactListSwift3UITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FetchContactListSwift3UITests.swift 3 | // FetchContactListSwift3UITests 4 | // 5 | // Created by piyush sinroja on 12/01/17. 6 | // Copyright © 2017 Piyush. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class FetchContactListSwift3UITests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | 18 | // In UI tests it is usually best to stop immediately when a failure occurs. 19 | continueAfterFailure = false 20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 21 | XCUIApplication().launch() 22 | 23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 24 | } 25 | 26 | override func tearDown() { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | super.tearDown() 29 | } 30 | 31 | func testExample() { 32 | // Use recording to get started writing UI tests. 33 | // Use XCTAssert and related functions to verify your tests produce the correct results. 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /FetchContactListSwift3/FetchContactListSwift3UITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Images/Simulator Screen Shot 09-Feb-2017, 5.32.32 PM.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/Images/Simulator Screen Shot 09-Feb-2017, 5.32.32 PM.jpg -------------------------------------------------------------------------------- /Images/Simulator Screen Shot 09-Feb-2017, 5.32.37 PM.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/Images/Simulator Screen Shot 09-Feb-2017, 5.32.37 PM.jpg -------------------------------------------------------------------------------- /Images/Simulator Screen Shot 09-Feb-2017, 5.32.49 PM.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/Images/Simulator Screen Shot 09-Feb-2017, 5.32.49 PM.jpg -------------------------------------------------------------------------------- /Images/Simulator Screen Shot 09-Feb-2017, 5.32.54 PM.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/Images/Simulator Screen Shot 09-Feb-2017, 5.32.54 PM.jpg -------------------------------------------------------------------------------- /Images/Simulator Screen Shot 09-Feb-2017, 5.59.31 PM.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piyush-Sinroja/ContactHelperSwift3/25552e2b14efdc50b327118d8c300a81bc315939/Images/Simulator Screen Shot 09-Feb-2017, 5.59.31 PM.jpg -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 IosPower 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ContactHelperSwift3 2 | ContactHelperSwift3 contains Fetch, Delete, Add and Update Contact Functionality 3 | 4 | Contact List And Search Contact 5 | ![alt tag](https://github.com/IosPower/ContactHelperSwift3/blob/master/Images/Simulator%20Screen%20Shot%2009-Feb-2017%2C%205.32.32%20PM.jpg) 6 | 7 | Delete Contact 8 | 9 | ![alt tag](https://github.com/IosPower/ContactHelperSwift3/blob/master/Images/Simulator%20Screen%20Shot%2009-Feb-2017%2C%205.32.37%20PM.jpg) 10 | 11 | Add Contact 12 | 13 | ![alt tag](https://github.com/IosPower/ContactHelperSwift3/blob/master/Images/Simulator%20Screen%20Shot%2009-Feb-2017%2C%205.32.54%20PM.jpg) 14 | 15 | Update Contact 16 | 17 | ![alt tag](https://github.com/IosPower/ContactHelperSwift3/blob/master/Images/Simulator%20Screen%20Shot%2009-Feb-2017%2C%205.32.49%20PM.jpg) 18 | 19 | CountrySelect 20 | 21 | ![alt tag](https://github.com/IosPower/ContactHelperSwift3/blob/master/Images/Simulator%20Screen%20Shot%2009-Feb-2017%2C%205.59.31%20PM.jpg) 22 | ContactHelper 23 | 24 | with the help of this, We can Fetch Contact, Delete Contact from Device and Add/Update Contact To Device. We Can also modify According to our requirement. 25 | 26 | Advantages of this Demo: 27 | 1: Contact Functionality 28 | 29 | Fetch , Delete , Update, Add Contact 30 | 31 | 2: Country Picker Functionality 32 | 33 | Search Functionality, Country picker Added, Country JSON Self Made. Convert Country Code To Country Name. 34 | 35 | Steps: 36 | 37 | 1. import Contacts and ContactsUI frameworks in your project. 38 | 39 | 2. In info.plist File add key : 40 | Privacy - Contacts Usage Description. 41 | 42 | 3. Add this line In viewWillAppear function 43 | 44 | ContactHelper.objContactHelper.delegateContact = self 45 | 46 | 4. Fetch Contact Details 47 | 48 | ContactHelper.objContactHelper.getContactList(controller: self) 49 | 50 | // Here Self is ViewController 51 | 52 | // When We Call Above Method then Below Delegate Method is Automatic Call Through Delegate 53 | 54 | func allContactList(array: NSArray) 55 | 56 | this method is Delegate Method that Contains 57 | Array of Contact Details 58 | 59 | 5. Add NewContact Details 60 | 61 | ContactHelper.objContactHelper.addContact(addDic: dicDetails, controller : self) 62 | 63 | // Here DicDetails 64 | 65 | let DicDetails: NSDictionary = ["Fullname": ArrayOFFullname , "Mobile": fullNo, "EmailID" : emailId] 66 | 67 | // self is ViewController 68 | 69 | 6. Update Contact Details 70 | 71 | ContactHelper.objContactHelper.updateContact(addDic: dicDetails, contactModel: contactModel!, controller: self) 72 | 73 | // Here DicDetails 74 | 75 | let DicDetails: NSDictionary = ["Fullname": ArrayOFFullname , "Mobile": fullNo, "EmailID" : emailId] 76 | 77 | // ContactModel is contactModel which you want to Update 78 | 79 | // self is ViewController 80 | 81 | // After Add/Update Method 82 | 83 | Below Delegate Method is Called 84 | 85 | func contactAddedOrUpdateSuccess() 86 | 87 | 7. Delete Contact Detail 88 | 89 | ContactHelper.objContactHelper.deleteContact(dicdata: dicData, controller: self) 90 | 91 | // Here Dicdata is your ContactDetails 92 | 93 | // in DicData ContactModel is Available which we want to Delete 94 | 95 | Note: please print DicData then You will know 96 | 97 | // self is ViewController 98 | 99 | // After Delete successfull 100 | Fetch Contact Details With this Delegate Method 101 | 102 | func allContactList(array: NSArray) 103 | 104 | 105 | 106 | 8. Take Extension of ContactFetchDelegate 107 | 108 | //These Are Delegate Methods of ContactFetchDelegate 109 | 110 | func allContactList(array: NSArray) 111 | func contactAddedOrUpdateSuccess() 112 | func updateDetails(indexpathValue: IndexPath) 113 | 114 | 9. You Can Also Modify ContactHelper.swift According yo your requirement 115 | 116 | // Please Check Demo For More Details 117 | 118 | --------------------------------------------------------------------------------