Skip to content

Swift Practice Codes: A repository exploring fundamental to intermediate Swift topics including Data Structures, Control Flow, and Functional Programming patterns.

Notifications You must be signed in to change notification settings

tadianazeemi04/Swift_practice_codes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swift Practice Codes 🍏

Welcome to the Swift Practice Codes repository! This project contains a collection of Swift scripts designed to demonstrate and practice core Swift programming concepts. It serves as a personal knowledge base and playground for intermediate Swift topics.

📚 Topics Covered

This repository covers various fundamental and intermediate Swift concepts, including:

  • Arrays: Initialization, manipulation, subscripting, iteration, and bulk updates.
  • Dictionaries: creating and managing key-value pairs.
  • Optionals: Handling nil safely using if let, guard, nil-coalescing (??), and forced unwrapping.
  • Closures: Syntax, capturing values, and passing closures as parameters.
  • Higher-Order Functions: Functional programming patterns using map, filter, and reduce.

📂 File Structure

Here is a quick guide to the files in this repository:

Category File(s) Description
Arrays array0.swift - array4iteration.swift Basics of arrays, subscripting, manipulation, and iteration.
Dictionaries dict0.swift Basic dictionary operations.
Functions sfunc0reduce.swift, sfunc1filter.swift, sfunc2map.swift Examples of higher-order functions (map, filter, reduce).
Optionals optional*.swift, if_let_binding.swift, nilCoalescing.swift Techniques for handling optional values safely.
Closures ClosuresInSwift.swift Examples of using closures and passing them to functions.
Misc swiftMain.txt Learning log and branch planning.

🚀 How to Run

You can run individual Swift files directly from the terminal.

Prerequisites

  • macOS with Xcode or Swift installed on your system.

Running a File

Open your terminal, navigate to the project directory, and run any file using the swift command:

# Navigate to the folder
cd /path/to/VsSwiftTraining

# Run a specific file (e.g., Array Manipulation)
swift array3manuplation.swift

# Run Closure examples
swift ClosuresInSwift.swift

🤝 Contributing

Feel free to add more examples or improve existing ones!

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/new-topic)
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

Happy Coding! 🚀

About

Swift Practice Codes: A repository exploring fundamental to intermediate Swift topics including Data Structures, Control Flow, and Functional Programming patterns.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages