Skip to content

Instantly share code, notes, and snippets.

Ahmed Hamdy dimohamdy

Block or report user

Report or block dimohamdy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Decode.swift
let jsonString = """
"id": 1,
"name": "yearly.plan",
"display_name": "الباقة اليومية",
"payment_method_key": "1",
"number_of_days": "35",
"payment_method_id": 3
View Database.swift
let realm = try! Realm()
let plan = realm.objects(Plan.self)
try! realm.write {
View Log.swift
CLSLogv("Log awesomeness %d %d %@", getVaList([1, 2, "three"]))
View Appdelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
// Use Firebase library to configure APIs
//get remote config from firebase
return true
View ViewController.swift
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var label: UILabel!
@IBOutlet weak var button: UIButton!
override func viewDidLoad() {
// Do any additional setup after loading the view, typically from a nib.
label.isHidden = LoginConfigManager.shared.config?.showLabel ?? false
View LoginConfig.swift
// LoginConfig.swift
// Create by Ahmed Tawfik on 15/1/2019
// Copyright © 2019. All rights reserved.
// Model file generated using JSONExport:
import Foundation
struct LoginConfig : Codable {
dimohamdy / LoginConfigManager.swift
Last active Jan 15, 2019
fetch config from firbase
View LoginConfigManager.swift
import Firebase
class LoginConfigManager {
static let shared = LoginConfigManager()
var config:LoginConfig? = nil
func getData() {
let remoteConfig = RemoteConfig.remoteConfig()
dimohamdy / Operation.swift
Created Jan 6, 2019
using AsyncOperation
View Operation.swift
import AsyncOperation
let op1 = AsyncBlockOperation() { operation in
operation.state = .executing
let urlString = URL(string: "")
if let url = urlString {
let task = URLSession.shared.dataTask(with: url) { (data, response, error) in
if error != nil {
dimohamdy / Operation.swift
Created Jan 6, 2019
add aDependency between operations
View Operation.swift
let queue = OperationQueue()
queue.maxConcurrentOperationCount = 1
queue.addOperations([op1,op2,op3], waitUntilFinished: true)
View Operation.swift
let queue = OperationQueue()
queue.maxConcurrentOperationCount = 1
queue.addOperations([op1,op2,op3], waitUntilFinished: true)
You can’t perform that action at this time.