https://github.com/zeeshan2k2/swift-data-flow
iOS Apps demonstrating forward and backward data flow in Swift using different methods.
https://github.com/zeeshan2k2/swift-data-flow
callback-functions delegate-methods delegates property-assignment swift uikit
Last synced: 10 months ago
JSON representation
iOS Apps demonstrating forward and backward data flow in Swift using different methods.
- Host: GitHub
- URL: https://github.com/zeeshan2k2/swift-data-flow
- Owner: zeeshan2k2
- Created: 2024-04-25T00:14:55.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-08T08:50:59.000Z (over 1 year ago)
- Last Synced: 2025-04-07T01:36:39.777Z (10 months ago)
- Topics: callback-functions, delegate-methods, delegates, property-assignment, swift, uikit
- Language: Swift
- Homepage:
- Size: 497 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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**