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.
- 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)
-
Clone the repository:
git clone https://github.com/yourusername/my-swift-short-note.git
-
Navigate to the project directory:
cd my-swift-short-note
-
Open the
basics.swift
file in your preferred Swift IDE (Xcode, Visual Studio Code, etc.): -
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.
- The
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!