Setup your class structure in Xcode Interface Builder and save() in Parse Server.

Overview

ISParseBind

With ISParseBind you can save, update and query PFObjects using the power of Xcode Interface Builder resources.

ISParseBind Video

https://www.youtube.com/watch?v=WCZRNC_mHNQ

Supported Components:

  • UITextField
  • TextView
  • UIImageView
  • UISlider
  • UISwitch
  • UILabel (Read Only)
  • UIButton (Comming soon for Radio Button)

Custom Components:

  • You can implement ISParseBindable protocol to create your own component.
  • All custom components need to subclass one of the supported components and to implement ISParseBindable

Requirements:

  • iOS 9 +
  • Swift 3

Install with Cocoapods:

  • pod 'ISParseBind'

How does it work? Interface Builder Step

  • Add a UIView in your xib/story board and set that as ISParseBindView subclass.
  • Add some components that implement ISParseBindable in that ISParseBindView.
  • On the Attributes Inspector, fill: FieldType, FieldPath and Persist - the others aren't required.
  • After setting up the components, you need right click on your ISParseBindView and bind it with ISParseBindable components.
  • Create an @IBoutlet to bind your ISParseBindView.

How does it work in practice? Code Step

Setup Parse Server credentials in AppDelegate, on "didFinishLaunchingWithOptions" method:

    let parseConfiguration = ParseClientConfiguration(block: { (ParseMutableClientConfiguration) -> Void in
        ParseMutableClientConfiguration.applicationId = "applicationID"
        ParseMutableClientConfiguration.clientKey = "clientKey"
        ParseMutableClientConfiguration.server = "serverURL"
    })
    
    Parse.initialize(with: parseConfiguration)

In some UIViewController, do:

1:

import ISParseBind

2:

@IBOutlet var parseBindView:ISParseBindView!

3: Implement ISParseBindViewDelegate.

It's not mandatory, but if you need to intercept some methods of before or after processing, implement:

parseBindView.delegate = self

extension yourViewController : ISParseBindViewDelegate {
  func willSave(view: ISParseBindView, object: PFObject) -> PFObject? {
        //If you need, you can intercept the current PFObject that will be saved and change some attributes before that. For example:
        //if object.parseClassName == "Car" {
        //    object["color"] = "Yellow"
        //}
        return object
    }
    
  func didSave(view: ISParseBindView, object: PFObject, isMainEntity:Bool, error: Error?) {
        
  }
  
  func didFetch(view: ISParseBindView, error: Error?) {
      print("finish fetch")
  }  
  
  func willFill(component: Any, value: Any) -> Any? {
      //Check wich component will be filled and return a custom value
      if let component = component as? UITextField, component == txtName {
          return "\(value as! String) Smith"

      //Return nil if you want to ignore the fill
      }else if let component = component as? UIImageView, component == imgPicture {
          return nil
      }

      return value
   }
    
  func didFill(component: Any, value: Any) { }

  func willSet(component: Any, value: Any) -> Any? {
      //Check wich component will be setup and return a custom value
      if let component = component as? UIImageView, component == imgPicture {
          return getImageInGrayScale(imgPicture.image)
      }        
      return value
  }

  func didSet(component: Any, value: Any) { }  
}

4:

self.parseBindView.save()

5: Optional Fetch/Query data. In viewDidLoad(), do:

self.parseBindView.parseObject = PFObject(withoutDataWithClassName: "SomeClass", objectId: "YYYYXXX")

ISParseBindable vars

Learn about how to use variables of ISParseBindable protocol works.

Variable Type Description
Required Bool (optional) Fill component is mandatory
Required Error String (optional) Error message if component is not filled
Field Type String: 'Text', 'Number', 'Logic' or 'Image' This is necessary for the algorithm to cast correctly for the corresponding field type in Parse.
Filed Type Error String (optional) Cast error message
Field Path String Path of the field on your class structure, for example: 'vehicle.brand.car.model'. Vehicule will be your main entity, 'Brand' and 'Car' will be relations class that will be created automatically, and 'model' will be the field of 'Car' Class.
Persist Bool If persist = false then this field will only use "read only" mode.

Developers can use optionals ISParseBindable vars to create your own field validator.

FieldTypeError, Required and Required Error is not used in ISParseBind algorithm. You can use as Helper to make your own validation rule.

Class Structure

  • Sample of Input in Field Path: "vehicle.brand.car.model", will generate this class structure:

    {
        vehicle = {
            brand = {
             	 car = {
                	     model: 
              	 }
            }
        }
    }
    • "model" value depends of its component's type. For example, if the component is a UITextField or a UITextView, the value will be a String. If the component is a UIImageView, however, the value will be a UIImage that will be cast to a PFFile in the algorithm.
    • In the above dictionary structure, the algorithm will generate 3 classes in the Parse Server: Vehicule, Brand and Car.
    • The last string after "." in the fieldPath will always be the field in Parse Server. 'model', in the given example, will be a field and not a class.
You might also like...
SwiftyReachability is a simple and lightweight network interface manager written in Swift.
SwiftyReachability is a simple and lightweight network interface manager written in Swift.

SwiftyReachability is a simple and lightweight network interface manager written in Swift. Freely inspired by https://github.com/tonymillion/Reachabil

Server-side Swift. The Perfect core toolset and framework for Swift Developers. (For mobile back-end development, website and API development, and more…)
Server-side Swift. The Perfect core toolset and framework for Swift Developers. (For mobile back-end development, website and API development, and more…)

Perfect: Server-Side Swift 简体中文 Perfect: Server-Side Swift Perfect is a complete and powerful toolbox, framework, and application server for Linux, iO

WKZombie is an iOS/OSX web-browser without a graphical user interface.
WKZombie is an iOS/OSX web-browser without a graphical user interface.

WKZombie is a Swift framework for iOS/OSX to navigate within websites and collect data without the need of User Interface or API, also known as Headless browser. It can be used to run automated tests / snapshots and manipulate websites using Javascript.

Apple watch app to interface with Transmission Client
Apple watch app to interface with Transmission Client

TransmissionWatch Apple watch app to interface with Transmission Client Currrent

A Swift web framework and HTTP server.
A Swift web framework and HTTP server.

A Swift Web Framework and HTTP Server Summary Kitura is a web framework and web server that is created for web services written in Swift. For more inf

Lightweight library for web server applications in Swift on macOS and Linux powered by coroutines.
Lightweight library for web server applications in Swift on macOS and Linux powered by coroutines.

Why Zewo? • Support • Community • Contributing Zewo Zewo is a lightweight library for web applications in Swift. What sets Zewo apart? Zewo is not a w

🔌  Non-blocking TCP socket layer, with event-driven server and client.
🔌 Non-blocking TCP socket layer, with event-driven server and client.

Original authors Honza Dvorsky - http://honzadvorsky.com, @czechboy0 Matthias Kreileder - @matthiaskr1 At the request of the original authors, we ask

A simple GCD based HTTP client and server, written in 'pure' Swift
A simple GCD based HTTP client and server, written in 'pure' Swift

SwiftyHTTP Note: I'm probably not going to update this any further - If you need a Swift networking toolset for the server side, consider: Macro.swift

WebSocket implementation for use by Client and Server

WebSocket ⚠️ This module contains no networking. To create a WebSocket Server, see WebSocketServer. To create a WebSocket Client, see WebSocketClient.

Owner
Weni
Weni
A lightweight, one line setup, iOS / OSX network debugging library! 🦊

Netfox provides a quick look on all executed network requests performed by your iOS or OSX app. It grabs all requests - of course yours, requests from

Christos Kasketis 3.4k Dec 28, 2022
A utility used to parse number strings

NumberParser is a Swift package used to parse number strings, e.g. "eight thousa

Dalton Claybrook 4 Dec 28, 2021
Layer + Parse iOS Example (Swift)

Note: I no longer actively working on this project. If you encounter any problem, please open an issue and hopefully the community will help out. If y

Kien 119 Feb 10, 2022
A library for Search & Parse the weather data from Wunderground & Openweathermap conveniently.

SmileWeather A library for Search & Parse the weather data from Wunderground & Openweathermap conveniently. #What can it do for you? 1. Handle all com

Rain 482 Sep 28, 2022
Access Xcode Server API with native Swift objects.

Xcode Server SDK Use Xcode Server's API with native Swift objects. First brought to you in Buildasaur, now in an independent project. This is an unoff

Buildasaurs 401 Dec 29, 2022
🌸 Powerful Codable API requests builder and manager for iOS.

This lib is about network requests with blackjack, roulette and craps! Using it you will be able to convert your massive API layer code into an awesom

CodyFire 251 Jan 8, 2023
A simple class to check for internet connection availability in Swift.

Reach A simple class to check for internet connection availability in Swift. Works for both 3G and WiFi connections. Install Manually Add the Reach.sw

Isuru Nanayakkara 459 Dec 29, 2022
Simple asynchronous HTTP networking class for Swift

YYHRequest YYHRequest is a simple and lightweight class for loading asynchronous HTTP requests in Swift. Built on NSURLConnection and NSOperationQueue

yayuhh 77 May 18, 2022
A new, clean and lean network interface reachability library written in Swift.

Reachability A new, clean and lean network interface reachability library written in Swift. Remarks Network reachability changes can be monitored usin

Alecrim 7 Aug 8, 2022
A peer to peer framework for OS X, iOS and watchOS 2 that presents a similar interface to the MultipeerConnectivity framework

This repository is a peer to peer framework for OS X, iOS and watchOS 2 that presents a similar interface to the MultipeerConnectivity framework (which is iOS only) that lets you connect any 2 devices from any platform. This framework works with peer to peer networks like bluetooth and ad hoc wifi networks when available it also falls back onto using a wifi router when necessary. It is built on top of CFNetwork and NSNetService. It uses the newest Swift 2's features like error handling and protocol extensions.

Manav Gabhawala 93 Aug 2, 2022