├── Media ├── combine.gif └── combine.mp4 ├── CombineWithMVVM ├── Assets.xcassets │ ├── Contents.json │ ├── backgound.imageset │ │ ├── backgound.jpeg │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── ExtensionUITextField.swift ├── AppDelegate.swift ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── FormViewModel.swift ├── SceneDelegate.swift └── FormVC.swift ├── CombineWithMVVM.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── xcuserdata │ └── mac-00015.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist └── project.pbxproj ├── README.md └── LICENSE /Media/combine.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CombinePart-1/HEAD/Media/combine.gif -------------------------------------------------------------------------------- /Media/combine.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CombinePart-1/HEAD/Media/combine.mp4 -------------------------------------------------------------------------------- /CombineWithMVVM/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /CombineWithMVVM/Assets.xcassets/backgound.imageset/backgound.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CombinePart-1/HEAD/CombineWithMVVM/Assets.xcassets/backgound.imageset/backgound.jpeg -------------------------------------------------------------------------------- /CombineWithMVVM.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CombineWithMVVM.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CombineWithMVVM/Assets.xcassets/backgound.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "backgound.jpeg", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CombineWithMVVM.xcodeproj/xcuserdata/mac-00015.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CombineWithMVVM.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CombineUsingMVVM 2 | 3 | This combine demo with MVVM pattern is very simple and easy to understand. In this demo there is normal form validation for username and password. You can read more from [Medium](https://medium.com/mindful-engineering/saying-hello-to-combine-framework-part-1-30d9c07210df) 4 | 5 | ![video](/Media/combine.gif) 6 | 7 | # Description 8 | 9 | In this demo there are three textFields Username, Password and confirmpassword. If validations for Username and Password passes, then the submit button gets enabled. If any validation doesn't pass then we are showing the validation using the label. The changes are reactive to the textField changes. 10 | 11 | # UI Controls 12 | - UITextField 13 | - UIButton 14 | - UILabel 15 | 16 | # By Apple 17 | 18 | Xcode 11.1 19 | iOS 13 20 | 21 | # LICENSE! 22 | 23 | CombineWithMVVM is [MIT-licensed](/LICENSE). 24 | 25 | # Conclusion 26 | While there’s still a ton of information left to be discovered about Combine. I hope this article has cleared the power of combine in development. I’ll keep digging, and will report all of my new findings as soon as possible. 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 MindInventory 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 | -------------------------------------------------------------------------------- /CombineWithMVVM/ExtensionUITextField.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ExtensionUITextField.swift 3 | // CombineWithMVVM 4 | // 5 | // Created by mac-00015 on 02/12/19. 6 | // Copyright © 2019 mac-00015. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | extension UITextField { 13 | 14 | func setLeftPaddingPoints(_ amount:CGFloat) { 15 | let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: amount, height: self.frame.size.height)) 16 | self.leftView = paddingView 17 | self.leftViewMode = .always 18 | } 19 | 20 | func setRightPaddingPoints(_ amount:CGFloat) { 21 | let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: amount, height: self.frame.size.height)) 22 | self.rightView = paddingView 23 | self.rightViewMode = .always 24 | } 25 | 26 | func addRightView(txtField: UITextField, str: String) { 27 | let rightStr = UILabel(frame: CGRect(x: 0, y: 0, width: self.frame.size.height, height: self.frame.size.height)) 28 | rightStr.text = str + " " 29 | txtField.rightView = rightStr 30 | txtField.rightViewMode = .always 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CombineWithMVVM/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CombineWithMVVM 4 | // 5 | // Created by mac-00015 on 29/11/19. 6 | // Copyright © 2019 mac-00015. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 24 | // Called when a new scene session is being created. 25 | // Use this method to select a configuration to create the new scene with. 26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 27 | } 28 | 29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 30 | // Called when the user discards a scene session. 31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /CombineWithMVVM/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 | -------------------------------------------------------------------------------- /CombineWithMVVM/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 | } -------------------------------------------------------------------------------- /CombineWithMVVM/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 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | UISceneStoryboardFile 37 | Main 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIMainStoryboardFile 45 | Main 46 | UIRequiredDeviceCapabilities 47 | 48 | armv7 49 | 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | UISupportedInterfaceOrientations~ipad 57 | 58 | UIInterfaceOrientationPortrait 59 | UIInterfaceOrientationPortraitUpsideDown 60 | UIInterfaceOrientationLandscapeLeft 61 | UIInterfaceOrientationLandscapeRight 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /CombineWithMVVM/FormViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormViewModel.swift 3 | // CombineDemoWithUIKit 4 | // 5 | // Created by mac-00015 on 29/11/19. 6 | // Copyright © 2019 mac-00015. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Combine 11 | 12 | class FormViewModel { 13 | 14 | @Published var username = "" 15 | @Published var password = "" 16 | @Published var confirmPassword = "" 17 | 18 | let usernameMessagePublisher = PassthroughSubject() 19 | let passwordMessagePublisher = PassthroughSubject() 20 | 21 | var validatedUsername: AnyPublisher { 22 | 23 | return $username 24 | .map { name in 25 | 26 | guard name.count != 0 else { 27 | 28 | self.usernameMessagePublisher.send("Username can't be blank") 29 | return nil 30 | } 31 | 32 | guard name.count > 2 else { 33 | 34 | self.usernameMessagePublisher.send("Minimum of 3 characters required") 35 | return nil 36 | } 37 | 38 | self.usernameMessagePublisher.send("") 39 | return name 40 | } 41 | .eraseToAnyPublisher() 42 | } 43 | 44 | var validatedPassword: AnyPublisher { 45 | 46 | return Publishers.CombineLatest($password, $confirmPassword) 47 | .receive(on: RunLoop.main) 48 | .map { pass, confPass in 49 | 50 | guard confPass == pass, pass.count > 4 else { 51 | 52 | self.passwordMessagePublisher.send("Values must match and have at least 5 characters") 53 | return nil 54 | } 55 | 56 | self.passwordMessagePublisher.send("") 57 | 58 | return pass 59 | } 60 | .eraseToAnyPublisher() 61 | } 62 | 63 | var readyToSubmit: AnyPublisher<(String, String)?, Never> { 64 | 65 | return Publishers.CombineLatest(validatedUsername, validatedPassword) 66 | .map { name, pass in 67 | 68 | guard let name = name, let pass = pass else { 69 | return nil 70 | } 71 | return (name, pass) 72 | } 73 | .eraseToAnyPublisher() 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /CombineWithMVVM/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // CombineWithMVVM 4 | // 5 | // Created by mac-00015 on 29/11/19. 6 | // Copyright © 2019 mac-00015. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | 16 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 17 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 18 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 19 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 20 | guard let _ = (scene as? UIWindowScene) else { return } 21 | } 22 | 23 | func sceneDidDisconnect(_ scene: UIScene) { 24 | // Called as the scene is being released by the system. 25 | // This occurs shortly after the scene enters the background, or when its session is discarded. 26 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 27 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 28 | } 29 | 30 | func sceneDidBecomeActive(_ scene: UIScene) { 31 | // Called when the scene has moved from an inactive state to an active state. 32 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 33 | } 34 | 35 | func sceneWillResignActive(_ scene: UIScene) { 36 | // Called when the scene will move from an active state to an inactive state. 37 | // This may occur due to temporary interruptions (ex. an incoming phone call). 38 | } 39 | 40 | func sceneWillEnterForeground(_ scene: UIScene) { 41 | // Called as the scene transitions from the background to the foreground. 42 | // Use this method to undo the changes made on entering the background. 43 | } 44 | 45 | func sceneDidEnterBackground(_ scene: UIScene) { 46 | // Called as the scene transitions from the foreground to the background. 47 | // Use this method to save data, release shared resources, and store enough scene-specific state information 48 | // to restore the scene back to its current state. 49 | } 50 | 51 | 52 | } 53 | 54 | -------------------------------------------------------------------------------- /CombineWithMVVM/FormVC.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormVC.swift 3 | // CombineDemoWithUIKit 4 | // 5 | // Created by mac-00015 on 29/11/19. 6 | // Copyright © 2019 mac-00015. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Combine 11 | 12 | class FormVC: UIViewController { 13 | 14 | @IBOutlet weak var txtUsername: UITextField! 15 | @IBOutlet weak var txtPassword: UITextField! 16 | @IBOutlet weak var txtConfirmPassword: UITextField! 17 | @IBOutlet weak var lblUsernameMessage: UILabel! 18 | @IBOutlet weak var lblPasswordMessage: UILabel! 19 | @IBOutlet weak var btnSubmit: UIButton! 20 | 21 | var usernameSubsciber: AnyCancellable? 22 | var passwordSubsciber: AnyCancellable? 23 | 24 | private var cancellableSet: Set = [] 25 | private var formViewModel = FormViewModel() 26 | 27 | override func viewDidLoad() { 28 | 29 | super.viewDidLoad() 30 | self.initialization() 31 | } 32 | } 33 | 34 | // MARK:- Initialization 35 | // MARK:- 36 | extension FormVC { 37 | 38 | fileprivate func initialization() { 39 | 40 | self.setupTextFields() 41 | 42 | let username = formViewModel.usernameMessagePublisher 43 | .receive(on: RunLoop.main) 44 | .sink { [weak self] (str) in 45 | 46 | guard let `self` = self else { 47 | return 48 | } 49 | 50 | self.lblUsernameMessage.text = str 51 | if str != "" { 52 | self.txtUsername.addRightView(txtField: self.txtUsername, str: "") 53 | } else { 54 | self.txtUsername.addRightView(txtField: self.txtUsername, str: "👍🏻") 55 | } 56 | } 57 | usernameSubsciber = AnyCancellable(username) 58 | 59 | let password = formViewModel.passwordMessagePublisher 60 | .receive(on: RunLoop.main) 61 | .sink { [weak self] (str) in 62 | 63 | guard let `self` = self else { 64 | return 65 | } 66 | 67 | self.lblPasswordMessage.text = str 68 | if str != "" { 69 | self.txtPassword.addRightView(txtField: self.txtPassword, str: "") 70 | self.txtConfirmPassword.addRightView(txtField: self.txtConfirmPassword, str: "") 71 | } else { 72 | self.txtPassword.addRightView(txtField: self.txtPassword, str: "👍🏻") 73 | self.txtConfirmPassword.addRightView(txtField: self.txtConfirmPassword, str: "👍🏻") 74 | } 75 | } 76 | passwordSubsciber = AnyCancellable(password) 77 | 78 | formViewModel.readyToSubmit 79 | .map { $0 != nil} 80 | .receive(on: RunLoop.main) 81 | .sink(receiveValue: { (isEnable) in 82 | if isEnable { 83 | self.btnSubmit.backgroundColor = .systemGreen 84 | } else { 85 | self.btnSubmit.backgroundColor = .red 86 | } 87 | self.btnSubmit.isEnabled = isEnable 88 | }) 89 | .store(in: &cancellableSet) 90 | } 91 | 92 | fileprivate func setupTextFields() { 93 | 94 | DispatchQueue.main.async { [weak self] in 95 | 96 | guard let `self` = self else { 97 | return 98 | } 99 | 100 | self.txtUsername.layer.cornerRadius = 10 101 | self.txtUsername.setLeftPaddingPoints(10) 102 | self.txtUsername.setRightPaddingPoints(10) 103 | self.txtUsername.attributedPlaceholder = NSAttributedString(string: "Username", attributes: [NSAttributedString.Key.foregroundColor: UIColor.darkGray]) 104 | self.txtPassword.layer.cornerRadius = 10 105 | self.txtPassword.setLeftPaddingPoints(10) 106 | self.txtPassword.setRightPaddingPoints(10) 107 | self.txtPassword.attributedPlaceholder = NSAttributedString(string: "Password", attributes: [NSAttributedString.Key.foregroundColor: UIColor.darkGray]) 108 | self.txtConfirmPassword.layer.cornerRadius = 10 109 | self.txtConfirmPassword.setLeftPaddingPoints(10) 110 | self.txtConfirmPassword.setRightPaddingPoints(10) 111 | self.txtConfirmPassword.attributedPlaceholder = NSAttributedString(string: "Confirm Password", attributes: [NSAttributedString.Key.foregroundColor: UIColor.darkGray]) 112 | self.btnSubmit.layer.cornerRadius = self.btnSubmit.frame.height / 2 113 | } 114 | } 115 | } 116 | 117 | // MARK:- Action Events 118 | // MARK:- 119 | extension FormVC { 120 | 121 | @IBAction func updateUserName(_ sender: UITextField) { 122 | formViewModel.username = sender.text ?? "" 123 | } 124 | 125 | @IBAction func updatePassword(_ sender: UITextField) { 126 | formViewModel.password = sender.text ?? "" 127 | } 128 | 129 | @IBAction func updateConfirmPassword(_ sender: UITextField) { 130 | formViewModel.confirmPassword = sender.text ?? "" 131 | } 132 | 133 | @IBAction func btnSubmitClicked(_ sender: UIButton) { 134 | 135 | 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /CombineWithMVVM/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 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 76 | 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 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /CombineWithMVVM.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5AE120F42390F4EC006B103C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AE120F32390F4EC006B103C /* AppDelegate.swift */; }; 11 | 5AE120F62390F4EC006B103C /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AE120F52390F4EC006B103C /* SceneDelegate.swift */; }; 12 | 5AE120FB2390F4EC006B103C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5AE120F92390F4EC006B103C /* Main.storyboard */; }; 13 | 5AE120FD2390F4EF006B103C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5AE120FC2390F4EF006B103C /* Assets.xcassets */; }; 14 | 5AE121002390F4EF006B103C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5AE120FE2390F4EF006B103C /* LaunchScreen.storyboard */; }; 15 | 5AE121252390F514006B103C /* FormViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AE121232390F514006B103C /* FormViewModel.swift */; }; 16 | 5AE121262390F514006B103C /* FormVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AE121242390F514006B103C /* FormVC.swift */; }; 17 | 5AFDDFD32394F1060089E2E9 /* ExtensionUITextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AFDDFD22394F1060089E2E9 /* ExtensionUITextField.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 5AE120F02390F4EC006B103C /* CombineWithMVVM.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CombineWithMVVM.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | 5AE120F32390F4EC006B103C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 23 | 5AE120F52390F4EC006B103C /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 24 | 5AE120FA2390F4EC006B103C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | 5AE120FC2390F4EF006B103C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | 5AE120FF2390F4EF006B103C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | 5AE121012390F4EF006B103C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | 5AE121232390F514006B103C /* FormViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormViewModel.swift; sourceTree = ""; }; 29 | 5AE121242390F514006B103C /* FormVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormVC.swift; sourceTree = ""; }; 30 | 5AFDDFD22394F1060089E2E9 /* ExtensionUITextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionUITextField.swift; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | 5AE120ED2390F4EC006B103C /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | 5AE120E72390F4EC006B103C = { 45 | isa = PBXGroup; 46 | children = ( 47 | 5AE120F22390F4EC006B103C /* CombineWithMVVM */, 48 | 5AE120F12390F4EC006B103C /* Products */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | 5AE120F12390F4EC006B103C /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | 5AE120F02390F4EC006B103C /* CombineWithMVVM.app */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | 5AE120F22390F4EC006B103C /* CombineWithMVVM */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 5AE120F32390F4EC006B103C /* AppDelegate.swift */, 64 | 5AE120F52390F4EC006B103C /* SceneDelegate.swift */, 65 | 5AE121242390F514006B103C /* FormVC.swift */, 66 | 5AE121232390F514006B103C /* FormViewModel.swift */, 67 | 5AFDDFD22394F1060089E2E9 /* ExtensionUITextField.swift */, 68 | 5AE120F92390F4EC006B103C /* Main.storyboard */, 69 | 5AE120FC2390F4EF006B103C /* Assets.xcassets */, 70 | 5AE120FE2390F4EF006B103C /* LaunchScreen.storyboard */, 71 | 5AE121012390F4EF006B103C /* Info.plist */, 72 | ); 73 | path = CombineWithMVVM; 74 | sourceTree = ""; 75 | }; 76 | /* End PBXGroup section */ 77 | 78 | /* Begin PBXNativeTarget section */ 79 | 5AE120EF2390F4EC006B103C /* CombineWithMVVM */ = { 80 | isa = PBXNativeTarget; 81 | buildConfigurationList = 5AE1211A2390F4EF006B103C /* Build configuration list for PBXNativeTarget "CombineWithMVVM" */; 82 | buildPhases = ( 83 | 5AE120EC2390F4EC006B103C /* Sources */, 84 | 5AE120ED2390F4EC006B103C /* Frameworks */, 85 | 5AE120EE2390F4EC006B103C /* Resources */, 86 | ); 87 | buildRules = ( 88 | ); 89 | dependencies = ( 90 | ); 91 | name = CombineWithMVVM; 92 | productName = CombineWithMVVM; 93 | productReference = 5AE120F02390F4EC006B103C /* CombineWithMVVM.app */; 94 | productType = "com.apple.product-type.application"; 95 | }; 96 | /* End PBXNativeTarget section */ 97 | 98 | /* Begin PBXProject section */ 99 | 5AE120E82390F4EC006B103C /* Project object */ = { 100 | isa = PBXProject; 101 | attributes = { 102 | LastSwiftUpdateCheck = 1120; 103 | LastUpgradeCheck = 1120; 104 | ORGANIZATIONNAME = "mac-00015"; 105 | TargetAttributes = { 106 | 5AE120EF2390F4EC006B103C = { 107 | CreatedOnToolsVersion = 11.2; 108 | }; 109 | }; 110 | }; 111 | buildConfigurationList = 5AE120EB2390F4EC006B103C /* Build configuration list for PBXProject "CombineWithMVVM" */; 112 | compatibilityVersion = "Xcode 9.3"; 113 | developmentRegion = en; 114 | hasScannedForEncodings = 0; 115 | knownRegions = ( 116 | en, 117 | Base, 118 | ); 119 | mainGroup = 5AE120E72390F4EC006B103C; 120 | productRefGroup = 5AE120F12390F4EC006B103C /* Products */; 121 | projectDirPath = ""; 122 | projectRoot = ""; 123 | targets = ( 124 | 5AE120EF2390F4EC006B103C /* CombineWithMVVM */, 125 | ); 126 | }; 127 | /* End PBXProject section */ 128 | 129 | /* Begin PBXResourcesBuildPhase section */ 130 | 5AE120EE2390F4EC006B103C /* Resources */ = { 131 | isa = PBXResourcesBuildPhase; 132 | buildActionMask = 2147483647; 133 | files = ( 134 | 5AE121002390F4EF006B103C /* LaunchScreen.storyboard in Resources */, 135 | 5AE120FD2390F4EF006B103C /* Assets.xcassets in Resources */, 136 | 5AE120FB2390F4EC006B103C /* Main.storyboard in Resources */, 137 | ); 138 | runOnlyForDeploymentPostprocessing = 0; 139 | }; 140 | /* End PBXResourcesBuildPhase section */ 141 | 142 | /* Begin PBXSourcesBuildPhase section */ 143 | 5AE120EC2390F4EC006B103C /* Sources */ = { 144 | isa = PBXSourcesBuildPhase; 145 | buildActionMask = 2147483647; 146 | files = ( 147 | 5AE121262390F514006B103C /* FormVC.swift in Sources */, 148 | 5AFDDFD32394F1060089E2E9 /* ExtensionUITextField.swift in Sources */, 149 | 5AE120F42390F4EC006B103C /* AppDelegate.swift in Sources */, 150 | 5AE121252390F514006B103C /* FormViewModel.swift in Sources */, 151 | 5AE120F62390F4EC006B103C /* SceneDelegate.swift in Sources */, 152 | ); 153 | runOnlyForDeploymentPostprocessing = 0; 154 | }; 155 | /* End PBXSourcesBuildPhase section */ 156 | 157 | /* Begin PBXVariantGroup section */ 158 | 5AE120F92390F4EC006B103C /* Main.storyboard */ = { 159 | isa = PBXVariantGroup; 160 | children = ( 161 | 5AE120FA2390F4EC006B103C /* Base */, 162 | ); 163 | name = Main.storyboard; 164 | sourceTree = ""; 165 | }; 166 | 5AE120FE2390F4EF006B103C /* LaunchScreen.storyboard */ = { 167 | isa = PBXVariantGroup; 168 | children = ( 169 | 5AE120FF2390F4EF006B103C /* Base */, 170 | ); 171 | name = LaunchScreen.storyboard; 172 | sourceTree = ""; 173 | }; 174 | /* End PBXVariantGroup section */ 175 | 176 | /* Begin XCBuildConfiguration section */ 177 | 5AE121182390F4EF006B103C /* Debug */ = { 178 | isa = XCBuildConfiguration; 179 | buildSettings = { 180 | ALWAYS_SEARCH_USER_PATHS = NO; 181 | CLANG_ANALYZER_NONNULL = YES; 182 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 183 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 184 | CLANG_CXX_LIBRARY = "libc++"; 185 | CLANG_ENABLE_MODULES = YES; 186 | CLANG_ENABLE_OBJC_ARC = YES; 187 | CLANG_ENABLE_OBJC_WEAK = YES; 188 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 189 | CLANG_WARN_BOOL_CONVERSION = YES; 190 | CLANG_WARN_COMMA = YES; 191 | CLANG_WARN_CONSTANT_CONVERSION = YES; 192 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 193 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 194 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 195 | CLANG_WARN_EMPTY_BODY = YES; 196 | CLANG_WARN_ENUM_CONVERSION = YES; 197 | CLANG_WARN_INFINITE_RECURSION = YES; 198 | CLANG_WARN_INT_CONVERSION = YES; 199 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 200 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 201 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 202 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 203 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 204 | CLANG_WARN_STRICT_PROTOTYPES = YES; 205 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 206 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 207 | CLANG_WARN_UNREACHABLE_CODE = YES; 208 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 209 | COPY_PHASE_STRIP = NO; 210 | DEBUG_INFORMATION_FORMAT = dwarf; 211 | ENABLE_STRICT_OBJC_MSGSEND = YES; 212 | ENABLE_TESTABILITY = YES; 213 | GCC_C_LANGUAGE_STANDARD = gnu11; 214 | GCC_DYNAMIC_NO_PIC = NO; 215 | GCC_NO_COMMON_BLOCKS = YES; 216 | GCC_OPTIMIZATION_LEVEL = 0; 217 | GCC_PREPROCESSOR_DEFINITIONS = ( 218 | "DEBUG=1", 219 | "$(inherited)", 220 | ); 221 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 222 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 223 | GCC_WARN_UNDECLARED_SELECTOR = YES; 224 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 225 | GCC_WARN_UNUSED_FUNCTION = YES; 226 | GCC_WARN_UNUSED_VARIABLE = YES; 227 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 228 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 229 | MTL_FAST_MATH = YES; 230 | ONLY_ACTIVE_ARCH = YES; 231 | SDKROOT = iphoneos; 232 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 233 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 234 | }; 235 | name = Debug; 236 | }; 237 | 5AE121192390F4EF006B103C /* Release */ = { 238 | isa = XCBuildConfiguration; 239 | buildSettings = { 240 | ALWAYS_SEARCH_USER_PATHS = NO; 241 | CLANG_ANALYZER_NONNULL = YES; 242 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 243 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 244 | CLANG_CXX_LIBRARY = "libc++"; 245 | CLANG_ENABLE_MODULES = YES; 246 | CLANG_ENABLE_OBJC_ARC = YES; 247 | CLANG_ENABLE_OBJC_WEAK = YES; 248 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 249 | CLANG_WARN_BOOL_CONVERSION = YES; 250 | CLANG_WARN_COMMA = YES; 251 | CLANG_WARN_CONSTANT_CONVERSION = YES; 252 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 253 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 254 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 255 | CLANG_WARN_EMPTY_BODY = YES; 256 | CLANG_WARN_ENUM_CONVERSION = YES; 257 | CLANG_WARN_INFINITE_RECURSION = YES; 258 | CLANG_WARN_INT_CONVERSION = YES; 259 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 260 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 261 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 262 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 263 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 264 | CLANG_WARN_STRICT_PROTOTYPES = YES; 265 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 266 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 267 | CLANG_WARN_UNREACHABLE_CODE = YES; 268 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 269 | COPY_PHASE_STRIP = NO; 270 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 271 | ENABLE_NS_ASSERTIONS = NO; 272 | ENABLE_STRICT_OBJC_MSGSEND = YES; 273 | GCC_C_LANGUAGE_STANDARD = gnu11; 274 | GCC_NO_COMMON_BLOCKS = YES; 275 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 276 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 277 | GCC_WARN_UNDECLARED_SELECTOR = YES; 278 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 279 | GCC_WARN_UNUSED_FUNCTION = YES; 280 | GCC_WARN_UNUSED_VARIABLE = YES; 281 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 282 | MTL_ENABLE_DEBUG_INFO = NO; 283 | MTL_FAST_MATH = YES; 284 | SDKROOT = iphoneos; 285 | SWIFT_COMPILATION_MODE = wholemodule; 286 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 287 | VALIDATE_PRODUCT = YES; 288 | }; 289 | name = Release; 290 | }; 291 | 5AE1211B2390F4EF006B103C /* Debug */ = { 292 | isa = XCBuildConfiguration; 293 | buildSettings = { 294 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 295 | CODE_SIGN_IDENTITY = "iPhone Developer"; 296 | CODE_SIGN_STYLE = Manual; 297 | DEVELOPMENT_TEAM = 7224G6JACN; 298 | INFOPLIST_FILE = CombineWithMVVM/Info.plist; 299 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 300 | LD_RUNPATH_SEARCH_PATHS = ( 301 | "$(inherited)", 302 | "@executable_path/Frameworks", 303 | ); 304 | PRODUCT_BUNDLE_IDENTIFIER = com.mi.CombineWithMVVM; 305 | PRODUCT_NAME = "$(TARGET_NAME)"; 306 | PROVISIONING_PROFILE_SPECIFIER = "*PratikAccountDevelopment_19Aug2019"; 307 | SWIFT_VERSION = 5.0; 308 | TARGETED_DEVICE_FAMILY = "1,2"; 309 | }; 310 | name = Debug; 311 | }; 312 | 5AE1211C2390F4EF006B103C /* Release */ = { 313 | isa = XCBuildConfiguration; 314 | buildSettings = { 315 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 316 | CODE_SIGN_IDENTITY = "iPhone Developer"; 317 | CODE_SIGN_STYLE = Manual; 318 | DEVELOPMENT_TEAM = 7224G6JACN; 319 | INFOPLIST_FILE = CombineWithMVVM/Info.plist; 320 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 321 | LD_RUNPATH_SEARCH_PATHS = ( 322 | "$(inherited)", 323 | "@executable_path/Frameworks", 324 | ); 325 | PRODUCT_BUNDLE_IDENTIFIER = com.mi.CombineWithMVVM; 326 | PRODUCT_NAME = "$(TARGET_NAME)"; 327 | PROVISIONING_PROFILE_SPECIFIER = "*PratikAccountDevelopment_19Aug2019"; 328 | SWIFT_VERSION = 5.0; 329 | TARGETED_DEVICE_FAMILY = "1,2"; 330 | }; 331 | name = Release; 332 | }; 333 | /* End XCBuildConfiguration section */ 334 | 335 | /* Begin XCConfigurationList section */ 336 | 5AE120EB2390F4EC006B103C /* Build configuration list for PBXProject "CombineWithMVVM" */ = { 337 | isa = XCConfigurationList; 338 | buildConfigurations = ( 339 | 5AE121182390F4EF006B103C /* Debug */, 340 | 5AE121192390F4EF006B103C /* Release */, 341 | ); 342 | defaultConfigurationIsVisible = 0; 343 | defaultConfigurationName = Release; 344 | }; 345 | 5AE1211A2390F4EF006B103C /* Build configuration list for PBXNativeTarget "CombineWithMVVM" */ = { 346 | isa = XCConfigurationList; 347 | buildConfigurations = ( 348 | 5AE1211B2390F4EF006B103C /* Debug */, 349 | 5AE1211C2390F4EF006B103C /* Release */, 350 | ); 351 | defaultConfigurationIsVisible = 0; 352 | defaultConfigurationName = Release; 353 | }; 354 | /* End XCConfigurationList section */ 355 | }; 356 | rootObject = 5AE120E82390F4EC006B103C /* Project object */; 357 | } 358 | --------------------------------------------------------------------------------