Skip to content

ahmetbostanciklioglu/Struct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

🧱 Swift Basics: Struct

A concise, runnable playground for learning Swift structures

Platform Swift Xcode Stars Last Commit

📖 Overview

A struct in Swift is a value type used to group related data and behavior into a single, reusable model. This repository is a small, runnable Swift playground that demonstrates the core building blocks of structures — from a plain data model to properties, methods, and how to mutate a struct's values.

It is meant as a concise learning reference: open it, read the comments, and run each example to see the concepts in action.

📚 What it covers

  • Fundamental structs — defining a struct and creating instances via the memberwise initializer.
  • Default & typealias properties — giving a property a default value and using typealias for a property type.
  • Stored vs. computed properties — the difference between a value that is stored and one that is calculated on access.
  • Property observers — running code with didSet whenever a stored property changes.
  • Methods — adding functions that operate on a struct's properties.
  • Mutating methods — using the mutating keyword to change a struct's stored properties from within a method.

🚀 Getting Started

git clone https://github.com/ahmetbostanciklioglu/Struct.git
cd Struct

Unzip Struct.playground.zip, then open Struct.playground in Xcode. The playground runs automatically, or press Command-R to re-execute and watch the results appear in the sidebar.

📋 Requirements

  • macOS with Xcode installed
  • Swift 5+
  • A Swift Playground-capable environment (Xcode or Swift Playgrounds)

🧑‍💻 Author

Ahmet Bostancıklıoğlu@ahmetbostanciklioglu · ahmetbostancikli@gmail.com

⭐ If this helped you, consider giving the repo a star!

About

A concise, runnable Swift playground for learning structs: properties, methods, observers, and mutating functions.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors