Skip to content

ahmetbostanciklioglu/Protocols

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“œ Swift Basics: Protocols

A concise, runnable Swift Playground exploring how protocols work.

Platform Swift Playground Stars Last Commit

πŸ“– Overview

Protocols in Swift define a blueprint of properties and methods that a conforming type must implement, enabling flexible, decoupled, and reusable code. This repository is a small, self-contained Xcode Playground (Protocols.playground) that demonstrates the core building blocks of Swift protocols through short, runnable examples. It is meant as a concise learning reference rather than a full application.

🧩 What it covers

  • Protocols as a parameter type β€” declaring a protocol with a { get set } property and passing any conforming value into a function.
  • Adopting protocol properties in structs β€” struct types conforming to a protocol while adding their own extra properties.
  • Protocol inheritance β€” one protocol (TestModel) inheriting the requirements of another (Vehicle).
  • Protocol methods β€” declaring method requirements and composing multiple protocols through inheritance (InheritedProtocol).

πŸš€ Getting Started

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

Unzip Protocols.playground.zip, then open Protocols.playground in Xcode. The examples in Contents.swift run in the playground timeline.

πŸ“‹ Requirements

  • Xcode 12 or later
  • Swift 5
  • iOS playground target

πŸ§‘β€πŸ’» Author

Ahmet BostancΔ±klΔ±oğlu β€” @ahmetbostanciklioglu Β· ahmetbostancikli@gmail.com

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

About

A concise Swift Playground demonstrating protocols: parameter types, struct conformance, inheritance, and methods.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors