Skip to content

iOS Apps demonstrating forward and backward data flow in Swift using different methods.

Notifications You must be signed in to change notification settings

zeeshan2k2/Swift-Data-Flow

Repository files navigation

Data Passing in Swift Apps

This repository contains examples of data passing techniques in Swift for iOS development. The focus is on demonstrating various methods for forwarding and backward data passing between view controllers.

Data Passing Techniques

1. Direct Property Assignment (Forward Data Passing)

Description: This method is used to set properties directly on a view controller before presenting it. It's straightforward and typically used for simple forward data passing.

Example: Passing data from ViewController to TextViewController.

2. Callback-Based Data Passing (Backward Data Passing)

Description: This method uses completion handlers (callbacks) to send data back to the previous view controller after it is dismissed. It's useful for handling results or updates after an action.

Example: Sending text from TextViewController back to ViewController using a completion handler.

3. Delegate Methods (Both Forward and Backward Data Passing)

Description: Delegates are a flexible way to handle communication between view controllers or objects. They allow for both forward and backward data passing with a decoupled approach.

Example: Implementing a delegate protocol to pass text from TextViewController to ViewController.

Repository Structure

Forward Data Passing: Shows how to use direct property assignment for passing data forward. Backward Data Passing: Demonstrates using callback methods to pass data backward. Delegate Methods: Illustrates using delegate protocols for both forward and backward data passing.

ScreenShots

Forward Data Flow

Backward Data Flow

About

iOS Apps demonstrating forward and backward data flow in Swift using different methods.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages