Skip to content

Instantly share code, notes, and snippets.

View Azuredark2781's full-sized avatar

Azuredark2781(Gmail) Azuredark2781

View GitHub Profile
/*
here is stackView as tableView in table cell
Created by jeri pm
*/
import UIKit
class StepThreeTableViewCell: UITableViewCell {
@IBOutlet weak var titleTable: UILabel!
@IBOutlet weak var subview: UIView!
/*
here is stackView as tableView in table cell
Created by jeri pm
*/
import UIKit
class StepThreeTableViewCell: UITableViewCell {
@IBOutlet weak var titleTable: UILabel!
@IBOutlet weak var subview: UIView!
@Azuredark2781
Azuredark2781 / ScrollStackView.swift
Created October 24, 2024 03:38 — forked from k-o-d-e-n/ScrollStackView.swift
UIStackView + UIScrollView in single view. It has lazy loading of arranged views behaviour.
//
// ScrollStackView.swift
// iOS-Extensions
//
// Created by Denis Koryttsev on 07/08/2017.
// Copyright © 2017 Denis Koryttsev. All rights reserved.
//
import UIKit
@Azuredark2781
Azuredark2781 / ScrollStackView.swift
Created October 24, 2024 03:38 — forked from k-o-d-e-n/ScrollStackView.swift
UIStackView + UIScrollView in single view. It has lazy loading of arranged views behaviour.
//
// ScrollStackView.swift
// iOS-Extensions
//
// Created by Denis Koryttsev on 07/08/2017.
// Copyright © 2017 Denis Koryttsev. All rights reserved.
//
import UIKit
import UIKit
import PlaygroundSupport
let scrollView = UIScrollView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
scrollView.backgroundColor = .red
let stackView = UIStackView(frame: CGRect(x: 0, y: 0, width: 1000, height: 100))
stackView.backgroundColor = .gray
stackView.axis = .horizontal
stackView.spacing = 10
import UIKit
import PlaygroundSupport
let scrollView = UIScrollView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
scrollView.backgroundColor = .red
let stackView = UIStackView(frame: CGRect(x: 0, y: 0, width: 1000, height: 100))
stackView.backgroundColor = .gray
stackView.axis = .horizontal
stackView.spacing = 10
/*
Closure examples
(1) function in function.
Inner function has access to variables of the outer function
*/
func outer() -> Int {
var outerVar = 5
func inner() {
outerVar += 5
}
@Azuredark2781
Azuredark2781 / gist:88b4d4338faab81f97d8868a4b10e0ba
Created October 22, 2024 00:12 — forked from yannxou/gist:73fba6a4df515462a041
Swift: Computed lazy variable example
private lazy var debugLabel: UILabel = {
let label = UILabel(frame: CGRectMake(20, 20, 200, 20))
label.textColor = UIColor.redColor()
label.backgroundColor = UIColor.whiteColor()
return label
}() // the parentheses tells swift to use the return value of the closure, not the closure itself.
@Azuredark2781
Azuredark2781 / closures.swift
Created October 22, 2024 00:12 — forked from Piyush3dB/closures.swift
Swift playground for closures
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
//
// Closure basicsg
//
@Azuredark2781
Azuredark2781 / SwiftClosure.swift
Created October 22, 2024 00:10 — forked from nhathm/SwiftClosure.swift
Swift Closure
//: Playground - noun: a place where people can play
// nhathm01247@gmail.com
import Foundation
/** DECLARE A CLOSURE **/
// Declare a variable to hold a closure
var add: (Int, Int) -> Int