Memory management in Rust

Ownership

The Stack and the Heap

  • both stack and heap, are parts of memory available to a program during run time
  • data on the stack must have known, fixed size at compile time
  • data with unknown size at compile time or size that might change must be stored on the…


How would you describe a Swift language?

  • Closures unified with function pointers
  • Tuples and multiple return values
  • Generics
  • Fast and concise iteration over a range or collection
  • Structs that support methods, extensions, and protocols
  • Functional programming patterns, e.g., map and filter
  • Powerful error handling built-in
  • Advanced control flow with do, guard, defer, and repeat keywords

Use Intention-Revealing Names


Photo by Max Duzij on Unsplash
@objc protocol PaymentActionViews {   @objc optional  func hideView(view: UIView)
@objc optional func showView(view: UIView)
func setSelectButton(button: UIButton)
}
protocol Printable{
func canPrint() -> Bool
}
extension Printable{ func canPrint() -> Bool{
return true
}
}


Photo by Emile Perron on Unsplash

Problem

  • You do not have to read the following code ( it’s a piece of shit ) *
{   
if canBook == false{
hideWhileCash()
bookedStatus.text = "Locked"
paymentTypeStack.isHidden = true
process.isHidden = true…


CLeanCode


Clean Swift VIP

  • View Controller
  • Models
  • Router
  • Worker
  • Interactor
  • Presenter

View Controller

Ahmed Adam

iOS Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store