Skip to content

Instantly share code, notes, and snippets.

View alexpaul's full-sized avatar
:octocat:

Alex Paul alexpaul

:octocat:
View GitHub Profile
{
"results": [
{
"gender": "male",
"name": {
"title": "Monsieur",
"first": "Alfonso",
"last": "Rolland"
},
"location": {
@alexpaul
alexpaul / MakingSectionsFromArray.swift
Last active August 26, 2020 23:25
Making sections for a 2D array to be used in a CollectionView or TableView. [Fellow] => [[Fellow]]
// Making sections for a 2D array to be used in a CollectionView or TableView. [Fellow] => [[Fellow]]
import Foundation
struct Fellow {
let name: String
let cohort: String
static func allFellows() -> [Fellow] {
return [
@alexpaul
alexpaul / DSA-Rubric.md
Last active November 21, 2023 01:17
Rubric. Mock Interview. Technical Interview.

DSA Whiteboarding Rubric

 
// Summary of steps
/*
0. understand the prompt (question)
1. clarifying questions (ask at least 2 clarification questions)
2. pseudo code 
3. test your pseudo code 
4. ask the interviewer if you can start coding after testing your pseudocode
@alexpaul
alexpaul / AccessingFirebaseStorage.md
Last active April 21, 2020 10:02
Accessing manually uploaded media from Firebase Storage.

Accessing manually uploaded media from Firebase Storage.

Prerequisites

  • Firebase pods are installed
  • Firebase Storage is configured on your Firebase console.
  • Media has been uploaded to Firebase Storage.
  • You have already downloaded the Google-Info.plist file and added it to Xcode.
  • Firebase has been configured in the AppDelegate.
  • Firebase Authentication is configured or Firebase Storage read access is set to public i.e read: true;
@alexpaul
alexpaul / ScrollView.swift
Last active October 4, 2023 12:45
ScrollView programmatically. UIScrollView.
import UIKit
final class DetailView: UIView {
// setting up a scroll view
// 1. add scrollview
// 2. add content view
// 3. add subviews to content view
// Note: must set high priority of content view to low, default is 1000
@alexpaul
alexpaul / CustomDelegate-Flow.md
Last active March 1, 2023 20:55
Custom delegation. Protocol.

Delegates: You use delegates to interact with Cocoa objects that inform you of events in an app.
Apple docs - delegation

// Object A
class ViewController: UIViewController {
  override func viewDidLoad() {
    super.viewDidLoad()
  }
@alexpaul
alexpaul / GenericJSONParsing.swift
Last active July 24, 2020 19:43
Generic function to parse local JSON from either a dictionary or array structure. Bundle. JSON. Parsing.
extension Bundle {
enum BundleError: Error {
case noResource(String)
case noContents(String)
case decodingError(Error)
}
func parseJSONData<T: Decodable>(_ name: String, ext: String = "json") throws -> T {
guard let path = Bundle.main.path(forResource: name, ofType: ext) else {
throw BundleError.noResource(name)

Networking in iOS (Terminology)

  1. JSON - web api formatted data the is the most popular way of serving downloaded or uploaded content from a network resource
    {
      "language": "swift", 
      "releaseYear": 2014, 
      "url": "https://developer.apple.com/swift/images/swift-og.png"
    }
@alexpaul
alexpaul / AppStoreSubmission.md
Last active July 3, 2022 02:21
Apple AppStore Connect Submission Requirements.

App Store Submission

1. Key Terminologies

  • Xcode build
  • Archive
  • Provisioning Profile: Developer, Distribution
  • TestFlight
  • Privacy Policy
  • App Id
@alexpaul
alexpaul / Date.swift
Last active October 22, 2023 06:33
Using Date in Swift, using ISO8601DateFormatter() and DateFormatter()
// Date extension
extension Date {
static func getStringFromDate(date: Date) -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "EEEE, MMM d, yyyy"
let dateString = dateFormatter.string(from: date)
return dateString
}
static func getDateFromString(dateString: String) -> Date? {
let formatter = ISO8601DateFormatter()