A coding challenge for prospective Senior iOS Developers applying for a role on the IBA iOS developer team.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MY_DOMAIN = 'rezaarkan.com'; | |
const SLUG_TO_PAGE = { | |
'': '882cd6dd6e1e482d823b464f326213e5', | |
'now': '25b7df64071d420d8f609bf76d9f4114', | |
'portfolio': '6000547bed0d441793bfba1498c063e2', | |
'resume': '0934b80d2d1544f99dedadb00be9d146', | |
'recommendations': '29115129efa44f1a870f390dd2c0a6c0', | |
'photos': 'e78c0492a5ec486aa51f4cdb2c6f4603', | |
'blog': '29bb193c1a104ba2b832788b57d58cd6', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// HomeRecap.swift | |
// iosApp | |
// | |
import SwiftUI | |
import shared | |
struct HomeRecap: View { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
class APIService : NSObject { | |
private let sourcesURL = URL(string: "http://dummy.restapiexample.com/api/v1/employees")! | |
func apiToGetEmployeeData(completion : @escaping (Employees) -> ()){ | |
URLSession.shared.dataTask(with: sourcesURL) { (data, urlResponse, error) in | |
if let data = data { | |
let jsonDecoder = JSONDecoder() | |
let empData = try! jsonDecoder.decode(Employees.self, from: data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Lokalise | |
func applicationDidBecomeActive(_ application: UIApplication) { | |
Lokalise.shared.checkForUpdates { _, _ in } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import Firebase | |
import FirebaseAnalytics | |
//MARK - Analytics Service | |
protocol AnalyticsService { | |
func initialize(application: UIApplication, launchOptions: [UIApplication.LaunchOptionsKey: Any]?) | |
func track(event: AnalyticsEvent, parameters: [AnalyticsEventParameter : String]) | |
var trackingEvents: [AnalyticsEvent] { get } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension DispatchQueue { | |
func asyncConsumeInMainQueue<T>( | |
work: @escaping () throws -> T, | |
mainSuccess: @escaping (T) -> Void, | |
mainError: @escaping (Error) -> Void) { | |
async { | |
do { | |
let result = try work() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
public protocol AnalyticsServiceType { | |
var trackedEvents: [AnalyticsSectionEvent] { get } | |
func initialize(application: UIApplication, launchOptions: [UIApplication.LaunchOptionsKey: Any]?) | |
func track(event: AnalyticsEvent) | |
} | |
extension AnalyticsServiceType { | |
func shouldTrack(event: AnalyticsSectionEvent) -> Bool { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension DispatchGroup { | |
/// Completes a series of blocks and finally executes a completion handler. | |
/// | |
/// - Parameters: | |
/// - label: An optional DispatchQueue label (defaults to bg) | |
/// - qos: An optional DipatchQos (defaults to background) | |
/// - blocks: The series of blocks to call. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
typealias CompletionHandler = (() -> Void) | |
class DynamicValue<T> { | |
var value : T { | |
didSet { | |
self.notify() | |
} | |
} |