My Swift Short Note

This repository contains sample example codes that cover the basic concepts of Swift programming. Each concept is demonstrated with simple, easy-to-understand examples in the basics.swift file.

Concepts Covered

  • Variables (let, var)
  • Data Types
  • Strings
  • Integers, Decimals, and Booleans
  • Arrays
  • Dictionaries
  • Sets
  • Enums
  • Type Annotations
  • Conditions (if, switch, ternary)
  • Loops
  • Functions (all kinds)
  • Returning multiple values from functions
  • Providing default values for functions
  • Handling errors in functions
  • Closures
  • Structs
  • Computed Properties (mutating functions, dynamic properties)
  • Property Observers (didSet)
  • Custom Initializers
  • Access Control
  • Static properties & methods
  • Classes
  • Protocols & extensions
  • Optionals
  • Nil Coalescing (to be added)

How to Use

  1. Clone the repository:

    git clone https://github.com/yourusername/my-swift-short-note.git
  2. Navigate to the project directory:

    cd my-swift-short-note
  3. Open the basics.swift file in your preferred Swift IDE (Xcode, Visual Studio Code, etc.):

  4. Explore the examples:

    • The basics.swift file contains commented sections for each concept. You can run the file to see how each example works.
    • Modify the examples or add your own to further understand each concept.

Contributing

If you find any issues or have suggestions for additional examples, please feel free to open an issue or submit a pull request.


Happy coding!