Skip to content

ahmetbostanciklioglu/AccessControl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Swift Basics: Access Control

A concise, runnable playground demonstrating Swift access-control levels.

Platform Swift Playground Stars Last Commit

πŸ“– Overview

Access control in Swift restricts access to parts of your code from code in other source files and modules, letting you hide implementation details and expose only the interface you intend. This repository is a concise, runnable Xcode playground learning example: it defines a small AccessControl struct with a private stored property and a public method, then creates an instance and calls the method to illustrate how the different access levels behave.

πŸ“š What it covers

  • The private access level, applied to the struct's number stored property so it is not visible outside the enclosing scope.
  • The public access level, applied to a method (publicFunc()) intended to be exposed as part of the type's interface.
  • Defining a struct with a custom init(number:) initializer.
  • Instantiating the type and calling one of its methods in a live Swift playground.

πŸš€ Getting Started

git clone https://github.com/ahmetbostanciklioglu/AccessControl.git
cd AccessControl
unzip ControlTypes.playground.zip
open ControlTypes.playground

Open ControlTypes.playground in Xcode; the playground evaluates automatically and shows results inline in the sidebar.

πŸ“‹ Requirements

  • Xcode 12 or later
  • Swift 5+
  • iOS playground target (as configured in contents.xcplayground)

πŸ§‘β€πŸ’» 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 demonstrating access-control levels (private, public) on a struct.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors