Skip to content

re: Explain iOS development like I'm five VIEW POST


I've done a little bit of swift in before and can answer a handful of the questions.

Reusable functions

Swift allows methods to be static meaning you can call them without having to call a new instance of the class, similar to Java. I tend to make a class dedicated to them if needed for example:

class Helper {
  static func postRequest() -> [String:String] {
    return ["something here" : "something also here"]

Can then be called like so


Additionally i found it's possible to use structs as well as extensions

struct BackendError {
    var message : String

struct SuccessCall {
    var json : JSON

    var containsError : Bool {
        if let error = json["error"].string {
            return true
        else {
            return false


typealias FailureBlock  = (BackendError) -> Void
typealias SuccessBlock  = (SuccessCall) -> Void

typealias AlamoFireRequest = (path: String, method: Alamofire.Method, data: [String:String]) -> Request
typealias GetFunction = (path: String , data: [String : String], failureBlock: FailureBlock, successBlock: SuccessBlock) -> Void

class Backend {
   func getRequestToBackend (token: String )(path: String , data: [String : String], failureBlock: FailureBlock, successBlock: 


Extension example

extension Array {
    func sampleItem() -> T {
        let index = Int(arc4random_uniform(UInt32(self.count)))
        return self[index]


It kind of acts like a template of basic code needed to run the project out of the box. From this example it shows that its using the UIKit framework, and by seeing this we can see that the class needs to have some form of connection to the user interface

import UIKit

class AppDelegate: UIResponder, UIApplicationDelegate {

  var window: UIWindow?

The @UIApplicationMain attribute indicates that the application delegate is using this function and passing the class's name as the name of the delegate class.


I think that with swift there is multiple right ways, with the little experience I found that multiple methods and ways of doing something can always work as intended.

I believe majority of this info is correct, my swift knowledge is pretty low. But hope it can help in some way :p

code of conduct - report abuse