Skip to content

Instantly share code, notes, and snippets.

View funmia's full-sized avatar
💭
🥐

Funmi Adewodu funmia

💭
🥐
  • Stockholm
View GitHub Profile
@funmia
funmia / Concurrent-programming-in-iOS.md
Last active April 25, 2022 07:51
Concurrent programming in iOS

Sources:

https://learnappmaking.com/grand-central-dispatch-swift/

https://medium.com/flawless-app-stories/basics-of-parallel-programming-with-swift-93fee8425287 https://www.hackingwithswift.com/read/9/2/why-is-locking-the-ui-bad https://www.objc.io/issues/2-concurrency/

Synchronous vs Asynchronous programming:

Synchronous means to process 1 item completely at a time. Asynchronous Processing handles multiple items at the same time. It would e.g. process item1, pause for item2 and then continue and finish with item1.

@funmia
funmia / simple-app-structure.md
Created July 15, 2018 10:49
Simple App Structure (notes from ray wenderlich tutorial)

AppDelegate:

This is where you usually handle application events like; the app being moved into the background and notifications.

View Controller:

This is where is you have the logic of a current screen and to also access any controls that are on the screen. The UIViewController class defines the methods and properties for managing your views, handling events, transitioning from one view controller to another. You subclass UIViewController (or one of its subclasses) and add the custom code you need to implement your app’s behavior.

Main Storyboard

This where you can layout and customise all the screens in your app. Storyboard’s visual editor allows you to visually see all the screens at once, showing you the user flow of the app.

@funmia
funmia / navigation-and-segues.md
Last active July 15, 2018 10:54
Navigation Controller and Segues

Source: https://digitalleaves.com/blog/2017/05/navigation-segues-ios/

When a view controller is embedded in a navigation controller it has access to parts of the navigation controller. It allows for navigation between other screens and includes a back button, you can also add items to navigation bar programmatically.

Show(a.k.a: Push Segue)

  • Use (self.navigationController.push view controller) of your navigation controller to show other view controllers, this pushes it onto the stack
  • Use (self.navigationController.pop view controller) to dismiss the show segue, this pops a view controller from the navigation controller’s stack, and takes you back to the previous view controller.

Presenting other views modally

@funmia
funmia / unit-testing-swift.md
Created July 15, 2018 11:03
Unit Testing in Swift

Source: https://convertkit.s3.amazonaws.com/assets/documents/168/1303138/Unit_Testing_in_Swift_1.0.pdf

Notes:

  • To decide on what to test, make sure to test the basic requirements of your app
  • Your unit tests should verify that your code meets the requirements for your app. You won’t be able to test all the requirements, but if you can test some of them, you’ll be able to quickly verify that your app meets those requirements.
  • When doing TDD fix the compilation errors first then you can focus on the making the test pass
@funmia
funmia / Automatic-Reference-Counting-In-Swift.md
Created August 18, 2018 12:06
Automatic Reference Counting in Swift

Source: The Swift Programming Language (Swift 4.0.3). iBooks. https://itunes.apple.com/gb/book/the-swift-programming-language-swift-4-1/id881256329?mt=11

Swift uses Automatic reference Counting (ARC) to manages an app's memory usage. ARC frees up the memory used by class instances when those instances are no longer needed.

Reference counting only apply to class instances. It doesn't apply to enums and structs which are value types not reference types, and are not stored or passed by reference.

How ARC works

Every time an instance of a class is created, ARC allocates a chunk of memory to store information about that instance along with any stored properties associated with that instance.

@funmia
funmia / head-first-design-patterns-chapter1.md
Last active September 23, 2018 17:26
Head First Design Patterns - Chapter 1

source: http://shop.oreilly.com/product/9780596007126.do

Chapter 1

  • Inheritance: extends
  • Interface: implements

Design patterns elevate your thinking about architectures by letting you think at the pattern level, not the nitty gritty object level.

@funmia
funmia / setup-git-precommit-hook.md
Created October 1, 2018 21:14
prepend git commit with ticket id
@funmia
funmia / ui-view-animation-in-playground.md
Last active November 16, 2018 17:37
uiview-animation-in-playground
import UIKit
import PlaygroundSupport

let containerView = UIView(frame: CGRect(x: 0, y: 0, width: 300, height: 300))

containerView.backgroundColor = UIColor.white

let square = UIView(frame: CGRect(x: 50, y: 50, width: 100, height: 100))