├── .gitignore ├── Images ├── ButtonBackground.png ├── PassDataBetweenVCFirstScreen.jpg ├── PassDataBetweenVCInvalidInput.jpg └── SendDataBetweenVC.jpg ├── LICENSE ├── Pass-data-between-ViewControllers-via-Delegate-Protocols ├── How to Pass Data Between Two View Controllers.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── ilijamihajlovic.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── ilijamihajlovic.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist └── How to Pass Data Between Two View Controllers │ ├── Controller │ ├── AppDelegate.swift │ ├── FirstViewController.swift │ └── SecondViewController.swift │ ├── Extensions │ └── Extension.swift │ ├── Interface Builder │ └── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Resources │ └── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── Group 89.imageset │ │ ├── Contents.json │ │ └── Group 89.png │ │ └── blurredBackground.imageset │ │ ├── Contents.json │ │ └── blurredBackground.png │ └── Supporting Files │ └── Info.plist └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Build generated 2 | 3 | build/ 4 | 5 | DerivedData/ 6 | 7 | 8 | 9 | ## Various settings 10 | 11 | *.pbxuser 12 | 13 | !default.pbxuser 14 | 15 | *.mode1v3 16 | 17 | !default.mode1v3 18 | 19 | *.mode2v3 20 | 21 | !default.mode2v3 22 | 23 | *.perspectivev3 24 | 25 | !default.perspectivev3 26 | 27 | xcuserdata/ 28 | 29 | 30 | 31 | ## Other 32 | 33 | *.moved-aside 34 | 35 | *.xccheckout 36 | 37 | *.xcscmblueprint 38 | 39 | 40 | 41 | ## Obj-C/Swift specific 42 | 43 | *.hmap 44 | 45 | *.ipa 46 | 47 | *.dSYM.zip 48 | 49 | *.dSYM 50 | 51 | 52 | 53 | ## Playgrounds 54 | 55 | timeline.xctimeline 56 | 57 | playground.xcworkspace 58 | 59 | 60 | 61 | # Swift Package Manager 62 | 63 | # 64 | 65 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 66 | 67 | # Packages/ 68 | 69 | # Package.pins 70 | 71 | # Package.resolved 72 | 73 | .build/ 74 | 75 | 76 | 77 | # CocoaPods 78 | 79 | # 80 | 81 | # We recommend against adding the Pods directory to your .gitignore. However 82 | 83 | # you should judge for yourself, the pros and cons are mentioned at: 84 | 85 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 86 | 87 | # 88 | 89 | # Pods/ 90 | 91 | # 92 | 93 | # Add this line if you want to avoid checking in source code from the Xcode workspace 94 | 95 | # *.xcworkspace 96 | 97 | 98 | 99 | # Carthage 100 | 101 | # 102 | 103 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 104 | 105 | # Carthage/Checkouts 106 | 107 | 108 | 109 | Carthage/Build 110 | 111 | 112 | 113 | # fastlane 114 | 115 | # 116 | 117 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 118 | 119 | # screenshots whenever they are needed. 120 | 121 | # For more information about the recommended setup visit: 122 | 123 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 124 | 125 | 126 | 127 | fastlane/report.xml 128 | 129 | fastlane/Preview.html 130 | 131 | fastlane/screenshots/**/*.png 132 | 133 | fastlane/test_output 134 | 135 | 136 | 137 | # Code Injection 138 | 139 | # 140 | 141 | # After new code Injection tools there's a generated folder /iOSInjectionProject 142 | 143 | # https://github.com/johnno1962/injectionforxcode 144 | 145 | 146 | 147 | iOSInjectionProject/ 148 | -------------------------------------------------------------------------------- /Images/ButtonBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IlijaMihajlovic/Pass-data-between-ViewControllers-via-Delegate-Protocols/ba54c85f947dc988a082f3eabeb1f4e21faf6beb/Images/ButtonBackground.png -------------------------------------------------------------------------------- /Images/PassDataBetweenVCFirstScreen.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IlijaMihajlovic/Pass-data-between-ViewControllers-via-Delegate-Protocols/ba54c85f947dc988a082f3eabeb1f4e21faf6beb/Images/PassDataBetweenVCFirstScreen.jpg -------------------------------------------------------------------------------- /Images/PassDataBetweenVCInvalidInput.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IlijaMihajlovic/Pass-data-between-ViewControllers-via-Delegate-Protocols/ba54c85f947dc988a082f3eabeb1f4e21faf6beb/Images/PassDataBetweenVCInvalidInput.jpg -------------------------------------------------------------------------------- /Images/SendDataBetweenVC.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IlijaMihajlovic/Pass-data-between-ViewControllers-via-Delegate-Protocols/ba54c85f947dc988a082f3eabeb1f4e21faf6beb/Images/SendDataBetweenVC.jpg -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Ilija Mihajlovic 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 | -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2409E7012146543F00D0D8F2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2409E7002146543F00D0D8F2 /* AppDelegate.swift */; }; 11 | 2409E7032146543F00D0D8F2 /* FirstViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2409E7022146543F00D0D8F2 /* FirstViewController.swift */; }; 12 | 2409E7062146543F00D0D8F2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2409E7042146543F00D0D8F2 /* Main.storyboard */; }; 13 | 2409E7082146544000D0D8F2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2409E7072146544000D0D8F2 /* Assets.xcassets */; }; 14 | 2409E70B2146544000D0D8F2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2409E7092146544000D0D8F2 /* LaunchScreen.storyboard */; }; 15 | 2409E713214654BC00D0D8F2 /* SecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2409E712214654BC00D0D8F2 /* SecondViewController.swift */; }; 16 | 2409E7152146719900D0D8F2 /* Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2409E7142146719900D0D8F2 /* Extension.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 2409E6FD2146543F00D0D8F2 /* How to Pass Data Between Two View Controllers.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "How to Pass Data Between Two View Controllers.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 2409E7002146543F00D0D8F2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | 2409E7022146543F00D0D8F2 /* FirstViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstViewController.swift; sourceTree = ""; }; 23 | 2409E7052146543F00D0D8F2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 24 | 2409E7072146544000D0D8F2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 25 | 2409E70A2146544000D0D8F2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 26 | 2409E70C2146544000D0D8F2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 27 | 2409E712214654BC00D0D8F2 /* SecondViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondViewController.swift; sourceTree = ""; }; 28 | 2409E7142146719900D0D8F2 /* Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extension.swift; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 2409E6FA2146543F00D0D8F2 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 2409E6F42146543F00D0D8F2 = { 43 | isa = PBXGroup; 44 | children = ( 45 | 2409E6FF2146543F00D0D8F2 /* How to Pass Data Between Two View Controllers */, 46 | 2409E6FE2146543F00D0D8F2 /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | 2409E6FE2146543F00D0D8F2 /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | 2409E6FD2146543F00D0D8F2 /* How to Pass Data Between Two View Controllers.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | 2409E6FF2146543F00D0D8F2 /* How to Pass Data Between Two View Controllers */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 24C8525B2260F4F8006D20DD /* Controller */, 62 | 24C8525C2260F523006D20DD /* Extensions */, 63 | 24C8525E2260F56E006D20DD /* Resources */, 64 | 24C8525D2260F53F006D20DD /* Interface Builder */, 65 | 24C8525F2260F579006D20DD /* Supporting Files */, 66 | ); 67 | path = "How to Pass Data Between Two View Controllers"; 68 | sourceTree = ""; 69 | }; 70 | 24C8525B2260F4F8006D20DD /* Controller */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 2409E7022146543F00D0D8F2 /* FirstViewController.swift */, 74 | 2409E7002146543F00D0D8F2 /* AppDelegate.swift */, 75 | 2409E712214654BC00D0D8F2 /* SecondViewController.swift */, 76 | ); 77 | path = Controller; 78 | sourceTree = ""; 79 | }; 80 | 24C8525C2260F523006D20DD /* Extensions */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 2409E7142146719900D0D8F2 /* Extension.swift */, 84 | ); 85 | path = Extensions; 86 | sourceTree = ""; 87 | }; 88 | 24C8525D2260F53F006D20DD /* Interface Builder */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 2409E7042146543F00D0D8F2 /* Main.storyboard */, 92 | 2409E7092146544000D0D8F2 /* LaunchScreen.storyboard */, 93 | ); 94 | path = "Interface Builder"; 95 | sourceTree = ""; 96 | }; 97 | 24C8525E2260F56E006D20DD /* Resources */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 2409E7072146544000D0D8F2 /* Assets.xcassets */, 101 | ); 102 | path = Resources; 103 | sourceTree = ""; 104 | }; 105 | 24C8525F2260F579006D20DD /* Supporting Files */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 2409E70C2146544000D0D8F2 /* Info.plist */, 109 | ); 110 | path = "Supporting Files"; 111 | sourceTree = ""; 112 | }; 113 | /* End PBXGroup section */ 114 | 115 | /* Begin PBXNativeTarget section */ 116 | 2409E6FC2146543F00D0D8F2 /* How to Pass Data Between Two View Controllers */ = { 117 | isa = PBXNativeTarget; 118 | buildConfigurationList = 2409E70F2146544000D0D8F2 /* Build configuration list for PBXNativeTarget "How to Pass Data Between Two View Controllers" */; 119 | buildPhases = ( 120 | 2409E6F92146543F00D0D8F2 /* Sources */, 121 | 2409E6FA2146543F00D0D8F2 /* Frameworks */, 122 | 2409E6FB2146543F00D0D8F2 /* Resources */, 123 | ); 124 | buildRules = ( 125 | ); 126 | dependencies = ( 127 | ); 128 | name = "How to Pass Data Between Two View Controllers"; 129 | productName = "How to Pass Data Between Two View Controllers"; 130 | productReference = 2409E6FD2146543F00D0D8F2 /* How to Pass Data Between Two View Controllers.app */; 131 | productType = "com.apple.product-type.application"; 132 | }; 133 | /* End PBXNativeTarget section */ 134 | 135 | /* Begin PBXProject section */ 136 | 2409E6F52146543F00D0D8F2 /* Project object */ = { 137 | isa = PBXProject; 138 | attributes = { 139 | LastSwiftUpdateCheck = 0940; 140 | LastUpgradeCheck = 0940; 141 | ORGANIZATIONNAME = "Ilija Mihajlovic"; 142 | TargetAttributes = { 143 | 2409E6FC2146543F00D0D8F2 = { 144 | CreatedOnToolsVersion = 9.4.1; 145 | }; 146 | }; 147 | }; 148 | buildConfigurationList = 2409E6F82146543F00D0D8F2 /* Build configuration list for PBXProject "How to Pass Data Between Two View Controllers" */; 149 | compatibilityVersion = "Xcode 9.3"; 150 | developmentRegion = en; 151 | hasScannedForEncodings = 0; 152 | knownRegions = ( 153 | en, 154 | Base, 155 | ); 156 | mainGroup = 2409E6F42146543F00D0D8F2; 157 | productRefGroup = 2409E6FE2146543F00D0D8F2 /* Products */; 158 | projectDirPath = ""; 159 | projectRoot = ""; 160 | targets = ( 161 | 2409E6FC2146543F00D0D8F2 /* How to Pass Data Between Two View Controllers */, 162 | ); 163 | }; 164 | /* End PBXProject section */ 165 | 166 | /* Begin PBXResourcesBuildPhase section */ 167 | 2409E6FB2146543F00D0D8F2 /* Resources */ = { 168 | isa = PBXResourcesBuildPhase; 169 | buildActionMask = 2147483647; 170 | files = ( 171 | 2409E70B2146544000D0D8F2 /* LaunchScreen.storyboard in Resources */, 172 | 2409E7082146544000D0D8F2 /* Assets.xcassets in Resources */, 173 | 2409E7062146543F00D0D8F2 /* Main.storyboard in Resources */, 174 | ); 175 | runOnlyForDeploymentPostprocessing = 0; 176 | }; 177 | /* End PBXResourcesBuildPhase section */ 178 | 179 | /* Begin PBXSourcesBuildPhase section */ 180 | 2409E6F92146543F00D0D8F2 /* Sources */ = { 181 | isa = PBXSourcesBuildPhase; 182 | buildActionMask = 2147483647; 183 | files = ( 184 | 2409E713214654BC00D0D8F2 /* SecondViewController.swift in Sources */, 185 | 2409E7032146543F00D0D8F2 /* FirstViewController.swift in Sources */, 186 | 2409E7012146543F00D0D8F2 /* AppDelegate.swift in Sources */, 187 | 2409E7152146719900D0D8F2 /* Extension.swift in Sources */, 188 | ); 189 | runOnlyForDeploymentPostprocessing = 0; 190 | }; 191 | /* End PBXSourcesBuildPhase section */ 192 | 193 | /* Begin PBXVariantGroup section */ 194 | 2409E7042146543F00D0D8F2 /* Main.storyboard */ = { 195 | isa = PBXVariantGroup; 196 | children = ( 197 | 2409E7052146543F00D0D8F2 /* Base */, 198 | ); 199 | name = Main.storyboard; 200 | sourceTree = ""; 201 | }; 202 | 2409E7092146544000D0D8F2 /* LaunchScreen.storyboard */ = { 203 | isa = PBXVariantGroup; 204 | children = ( 205 | 2409E70A2146544000D0D8F2 /* Base */, 206 | ); 207 | name = LaunchScreen.storyboard; 208 | sourceTree = ""; 209 | }; 210 | /* End PBXVariantGroup section */ 211 | 212 | /* Begin XCBuildConfiguration section */ 213 | 2409E70D2146544000D0D8F2 /* Debug */ = { 214 | isa = XCBuildConfiguration; 215 | buildSettings = { 216 | ALWAYS_SEARCH_USER_PATHS = NO; 217 | CLANG_ANALYZER_NONNULL = YES; 218 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 219 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 220 | CLANG_CXX_LIBRARY = "libc++"; 221 | CLANG_ENABLE_MODULES = YES; 222 | CLANG_ENABLE_OBJC_ARC = YES; 223 | CLANG_ENABLE_OBJC_WEAK = YES; 224 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 225 | CLANG_WARN_BOOL_CONVERSION = YES; 226 | CLANG_WARN_COMMA = YES; 227 | CLANG_WARN_CONSTANT_CONVERSION = YES; 228 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 229 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 230 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 231 | CLANG_WARN_EMPTY_BODY = YES; 232 | CLANG_WARN_ENUM_CONVERSION = YES; 233 | CLANG_WARN_INFINITE_RECURSION = YES; 234 | CLANG_WARN_INT_CONVERSION = YES; 235 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 236 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 237 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 238 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 239 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 240 | CLANG_WARN_STRICT_PROTOTYPES = YES; 241 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 242 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 243 | CLANG_WARN_UNREACHABLE_CODE = YES; 244 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 245 | CODE_SIGN_IDENTITY = "iPhone Developer"; 246 | COPY_PHASE_STRIP = NO; 247 | DEBUG_INFORMATION_FORMAT = dwarf; 248 | ENABLE_STRICT_OBJC_MSGSEND = YES; 249 | ENABLE_TESTABILITY = YES; 250 | GCC_C_LANGUAGE_STANDARD = gnu11; 251 | GCC_DYNAMIC_NO_PIC = NO; 252 | GCC_NO_COMMON_BLOCKS = YES; 253 | GCC_OPTIMIZATION_LEVEL = 0; 254 | GCC_PREPROCESSOR_DEFINITIONS = ( 255 | "DEBUG=1", 256 | "$(inherited)", 257 | ); 258 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 259 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 260 | GCC_WARN_UNDECLARED_SELECTOR = YES; 261 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 262 | GCC_WARN_UNUSED_FUNCTION = YES; 263 | GCC_WARN_UNUSED_VARIABLE = YES; 264 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 265 | MTL_ENABLE_DEBUG_INFO = YES; 266 | ONLY_ACTIVE_ARCH = YES; 267 | SDKROOT = iphoneos; 268 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 269 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 270 | }; 271 | name = Debug; 272 | }; 273 | 2409E70E2146544000D0D8F2 /* Release */ = { 274 | isa = XCBuildConfiguration; 275 | buildSettings = { 276 | ALWAYS_SEARCH_USER_PATHS = NO; 277 | CLANG_ANALYZER_NONNULL = YES; 278 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 279 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 280 | CLANG_CXX_LIBRARY = "libc++"; 281 | CLANG_ENABLE_MODULES = YES; 282 | CLANG_ENABLE_OBJC_ARC = YES; 283 | CLANG_ENABLE_OBJC_WEAK = YES; 284 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 285 | CLANG_WARN_BOOL_CONVERSION = YES; 286 | CLANG_WARN_COMMA = YES; 287 | CLANG_WARN_CONSTANT_CONVERSION = YES; 288 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 289 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 290 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 291 | CLANG_WARN_EMPTY_BODY = YES; 292 | CLANG_WARN_ENUM_CONVERSION = YES; 293 | CLANG_WARN_INFINITE_RECURSION = YES; 294 | CLANG_WARN_INT_CONVERSION = YES; 295 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 296 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 297 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 298 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 299 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 300 | CLANG_WARN_STRICT_PROTOTYPES = YES; 301 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 302 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 303 | CLANG_WARN_UNREACHABLE_CODE = YES; 304 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 305 | CODE_SIGN_IDENTITY = "iPhone Developer"; 306 | COPY_PHASE_STRIP = NO; 307 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 308 | ENABLE_NS_ASSERTIONS = NO; 309 | ENABLE_STRICT_OBJC_MSGSEND = YES; 310 | GCC_C_LANGUAGE_STANDARD = gnu11; 311 | GCC_NO_COMMON_BLOCKS = YES; 312 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 313 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 314 | GCC_WARN_UNDECLARED_SELECTOR = YES; 315 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 316 | GCC_WARN_UNUSED_FUNCTION = YES; 317 | GCC_WARN_UNUSED_VARIABLE = YES; 318 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 319 | MTL_ENABLE_DEBUG_INFO = NO; 320 | SDKROOT = iphoneos; 321 | SWIFT_COMPILATION_MODE = wholemodule; 322 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 323 | VALIDATE_PRODUCT = YES; 324 | }; 325 | name = Release; 326 | }; 327 | 2409E7102146544000D0D8F2 /* Debug */ = { 328 | isa = XCBuildConfiguration; 329 | buildSettings = { 330 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 331 | CODE_SIGN_STYLE = Automatic; 332 | INFOPLIST_FILE = "$(SRCROOT)/How to Pass Data Between Two View Controllers/Supporting Files/Info.plist"; 333 | LD_RUNPATH_SEARCH_PATHS = ( 334 | "$(inherited)", 335 | "@executable_path/Frameworks", 336 | ); 337 | PRODUCT_BUNDLE_IDENTIFIER = "com.MafiaCaffe.How-to-Pass-Data-Between-Two-View-Controllers"; 338 | PRODUCT_NAME = "$(TARGET_NAME)"; 339 | SWIFT_VERSION = 4.0; 340 | TARGETED_DEVICE_FAMILY = "1,2"; 341 | }; 342 | name = Debug; 343 | }; 344 | 2409E7112146544000D0D8F2 /* Release */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 348 | CODE_SIGN_STYLE = Automatic; 349 | INFOPLIST_FILE = "$(SRCROOT)/How to Pass Data Between Two View Controllers/Supporting Files/Info.plist"; 350 | LD_RUNPATH_SEARCH_PATHS = ( 351 | "$(inherited)", 352 | "@executable_path/Frameworks", 353 | ); 354 | PRODUCT_BUNDLE_IDENTIFIER = "com.MafiaCaffe.How-to-Pass-Data-Between-Two-View-Controllers"; 355 | PRODUCT_NAME = "$(TARGET_NAME)"; 356 | SWIFT_VERSION = 4.0; 357 | TARGETED_DEVICE_FAMILY = "1,2"; 358 | }; 359 | name = Release; 360 | }; 361 | /* End XCBuildConfiguration section */ 362 | 363 | /* Begin XCConfigurationList section */ 364 | 2409E6F82146543F00D0D8F2 /* Build configuration list for PBXProject "How to Pass Data Between Two View Controllers" */ = { 365 | isa = XCConfigurationList; 366 | buildConfigurations = ( 367 | 2409E70D2146544000D0D8F2 /* Debug */, 368 | 2409E70E2146544000D0D8F2 /* Release */, 369 | ); 370 | defaultConfigurationIsVisible = 0; 371 | defaultConfigurationName = Release; 372 | }; 373 | 2409E70F2146544000D0D8F2 /* Build configuration list for PBXNativeTarget "How to Pass Data Between Two View Controllers" */ = { 374 | isa = XCConfigurationList; 375 | buildConfigurations = ( 376 | 2409E7102146544000D0D8F2 /* Debug */, 377 | 2409E7112146544000D0D8F2 /* Release */, 378 | ); 379 | defaultConfigurationIsVisible = 0; 380 | defaultConfigurationName = Release; 381 | }; 382 | /* End XCConfigurationList section */ 383 | }; 384 | rootObject = 2409E6F52146543F00D0D8F2 /* Project object */; 385 | } 386 | -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers.xcodeproj/project.xcworkspace/xcuserdata/ilijamihajlovic.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IlijaMihajlovic/Pass-data-between-ViewControllers-via-Delegate-Protocols/ba54c85f947dc988a082f3eabeb1f4e21faf6beb/Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers.xcodeproj/project.xcworkspace/xcuserdata/ilijamihajlovic.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers.xcodeproj/xcuserdata/ilijamihajlovic.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | How to Pass Data Between Two View Controllers.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | How to Pass Data Between Two View Controllers.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers/Controller/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // How to Pass Data Between Two View Controllers 4 | // 5 | // Created by Ilija Mihajlovic on 9/10/17. 6 | // Copyright © 2017 Ilija Mihajlovic. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 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 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers/Controller/FirstViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // How to Pass Data Between Two View Controllers 4 | // 5 | // Created by Ilija Mihajlovic on 9/10/17. 6 | // Copyright © 2017 Ilija Mihajlovic. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | //Delegate Class 12 | class FirstViewController: UIViewController, UITextFieldDelegate, CanReceive { 13 | 14 | //MARK: - Properties 15 | @IBOutlet weak var label: UILabel! 16 | @IBOutlet weak var textField: UITextField! 17 | 18 | 19 | override func viewDidLoad() { 20 | super.viewDidLoad() 21 | textField.delegate = self 22 | textField.returnKeyType = .done 23 | } 24 | 25 | //Dismiss the keyboard by tapping the done button 26 | func textFieldShouldReturn(_ textField: UITextField) -> Bool { 27 | self.view.endEditing(true) 28 | return false 29 | } 30 | 31 | 32 | @IBAction func sendButtonPressed(_ sender: UIButton) { 33 | 34 | if (textField.text?.count)! > 0 { 35 | performSegue(withIdentifier: "sendDataToSecondVC", sender: self) 36 | textField.text = "" 37 | 38 | } else { 39 | showAlert(title: "Invalid Input", message: "Please Enter Text in Text Field", actions: nil) 40 | } 41 | } 42 | 43 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 44 | 45 | //Check if this is the right segue identifier 46 | if segue.identifier == "sendDataToSecondVC" { 47 | 48 | //Get a refrence to the destination ViewController 49 | let secondVC = segue.destination as! SecondViewController 50 | secondVC.dataForSending = textField.text! 51 | secondVC.delegate = self 52 | } 53 | 54 | } 55 | 56 | //Implement the required delegate method 57 | func dataReceive(data: String) { 58 | label.text = data 59 | } 60 | 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers/Controller/SecondViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.swift 3 | // How to Pass Data Between Two View Controllers 4 | // 5 | // Created by Ilija Mihajlovic on 9/10/17. 6 | // Copyright © 2017 Ilija Mihajlovic. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | //Define the protocol 12 | protocol CanReceive { 13 | func dataReceive(data: String) 14 | } 15 | //Delegator Class 16 | class SecondViewController: UIViewController, UITextFieldDelegate { 17 | 18 | //MARK: - Properties 19 | var dataForSending = "" 20 | var delegate: CanReceive? 21 | 22 | @IBOutlet weak var label: UILabel! 23 | @IBOutlet weak var textField: UITextField! 24 | 25 | 26 | override func viewDidLoad() { 27 | super.viewDidLoad() 28 | label.text = dataForSending 29 | textField.delegate = self 30 | textField.returnKeyType = .done 31 | } 32 | 33 | //Dismiss the keyboard by tapping the done button 34 | func textFieldShouldReturn(_ textField: UITextField) -> Bool { 35 | self.view.endEditing(true) 36 | return false 37 | } 38 | 39 | //Dismiss the keyboard by tapping the done button 40 | @IBAction func sendDataBackToFirstVC(_ sender: UIButton) { 41 | if (textField.text?.count)! > 0 { 42 | delegate?.dataReceive(data: textField.text!) 43 | dismiss(animated: true, completion: nil) 44 | textField.text = "" 45 | 46 | } else { 47 | showAlert(title: "Invalid Input", message: "Please Enter Text in Text Field", actions: nil) 48 | } 49 | 50 | 51 | } 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers/Extensions/Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Extension.swift 3 | // How to Pass Data Between Two View Controllers 4 | // 5 | // Created by Ilija Mihajlovic on 9/10/17. 6 | // Copyright © 2017 Ilija Mihajlovic. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIViewController { 12 | 13 | func showAlert(title: String, message: String, actions: ((UIAlertAction) -> Void)?) { 14 | let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert) 15 | 16 | alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { (action) in 17 | alert.dismiss(animated: true, completion: nil) 18 | })) 19 | 20 | self.present(alert, animated: true, completion: nil) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers/Interface Builder/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 | -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers/Interface Builder/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 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 88 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 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 | 221 | 222 | 223 | 224 | 225 | 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 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 335 | 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 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers/Resources/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 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers/Resources/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers/Resources/Assets.xcassets/Group 89.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Group 89.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers/Resources/Assets.xcassets/Group 89.imageset/Group 89.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IlijaMihajlovic/Pass-data-between-ViewControllers-via-Delegate-Protocols/ba54c85f947dc988a082f3eabeb1f4e21faf6beb/Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers/Resources/Assets.xcassets/Group 89.imageset/Group 89.png -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers/Resources/Assets.xcassets/blurredBackground.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "blurredBackground.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers/Resources/Assets.xcassets/blurredBackground.imageset/blurredBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IlijaMihajlovic/Pass-data-between-ViewControllers-via-Delegate-Protocols/ba54c85f947dc988a082f3eabeb1f4e21faf6beb/Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers/Resources/Assets.xcassets/blurredBackground.imageset/blurredBackground.png -------------------------------------------------------------------------------- /Pass-data-between-ViewControllers-via-Delegate-Protocols/How to Pass Data Between Two View Controllers/Supporting Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | 45 | 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pass data between ViewControllers via Delegate Protocols 2 | Pass data between ViewControllers via Delegate & Protocols using the Swift Programming Language. 3 | ___ 4 | 5 | ## Side Note 6 | * Currently, I do not have an iPhone, so I'm unable to test the app on a physical device. I apologize in advance for maybe possible bugs. 7 | 8 | Kind regards, 9 | 10 | Ilija 🖖 😄 11 | ___ 12 | 13 | ## Getting the files 14 | 15 | * Use GitHub to clone the repository locally, or download the .zip file of the repository and extract the files. 16 | ___ 17 | 18 | ## Example how the UI looks 19 | 20 | * First View Controller with a keyboard and input 21 | 22 | 23 | ___ 24 | 25 | * First View Controller with an empty text field 26 | 27 | 28 | ___ 29 | 30 | * Second View Controller with an alert controller 31 | 32 | 33 | ___ 34 | 35 | ## License 36 | ``` 37 | MIT License 38 | 39 | Copyright (c) 2018 Ilija Mihajlovic 40 | 41 | Permission is hereby granted, free of charge, to any person obtaining a copy 42 | of this software and associated documentation files (the "Software"), to deal 43 | in the Software without restriction, including without limitation the rights 44 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 45 | copies of the Software, and to permit persons to whom the Software is 46 | furnished to do so, subject to the following conditions: 47 | 48 | The above copyright notice and this permission notice shall be included in all 49 | copies or substantial portions of the Software. 50 | 51 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 52 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 53 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 54 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 55 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 56 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 57 | SOFTWARE. 58 | ``` 59 | --------------------------------------------------------------------------------