Skip to content

Instantly share code, notes, and snippets.

@Emin-Emini
Created November 25, 2021 19:19
Show Gist options
  • Save Emin-Emini/1c6b9ea0958aa0e1d399e5feeb93fc32 to your computer and use it in GitHub Desktop.
Save Emin-Emini/1c6b9ea0958aa0e1d399e5feeb93fc32 to your computer and use it in GitHub Desktop.
Structure your Swift code in ViewControllers with Code Burger Method
//
// ViewController.swift
// Code Burger Method
//
// Created by Emin Emini on 25.11.21.
//
import UIKit
class ViewController: UIViewController {
// MARK: - Outlets (Bun)
@IBOutlet weak var myLabel: UILabel!
@IBOutlet weak var backButton: UIButton!
@IBOutlet weak var forwardButton: UIButton!
// MARK: - Properties (Cheese)
let someStringProperty = ""
// MARK: - View Functions (Pattie/s)
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
// MARK: - Actions (Bun)
@IBAction func goBack(_ sender: Any) {
loadLess()
}
@IBAction func goNext(_ sender: Any) {
loadMore()
}
}
// MARK: - Functions (Fries)
extension ViewController {
func loadLess() {
<#code#>
}
func loadMore() {
<#code#>
}
}
// MARK: - Table View (Soda)
extension ViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
<#code#>
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
<#code#>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment