Skip to content

Instantly share code, notes, and snippets.

View JaleelNazir's full-sized avatar
🐇
Focusing

Jaleel Nazir JaleelNazir

🐇
Focusing
View GitHub Profile
import UIKit
class FadeInOut: UIStoryboardSegue {
override func perform() {
let sourceView: UIView = self.source.view as UIView!
let destinationView: UIView = self.destination.view as UIView!
sourceView.alpha = 1.0
@JaleelNazir
JaleelNazir / parsing.swift
Last active July 27, 2017 06:27
file.json to Object Mapper class using SwiftyJSON
if let path = Bundle.main.path(forResource: "FeedFile", ofType: "json") {
do {
let data = try Data(contentsOf: URL(fileURLWithPath: path), options: .alwaysMapped)
let jsonData = JSON(data: data)
if jsonData != JSON.null {
if let arrOfFeed = Mapper<GlynkFeed>().mapArray(JSONObject: jsonData["feed"].arrayObject) {
if arrOfFeed.count > 0 {
if self.arrOfGlynkFeed == nil || self.refreshControl.isRefreshing {
self.arrOfGlynkFeed = arrOfFeed
localeIdentifier Description
eu Basque
hr_BA Croatian (Bosnia & Herzegovina)
en_CM English (Cameroon)
rw_RW Kinyarwanda (Rwanda)
en_SZ English (Swaziland)
tk_Latn Turkmen (Latin)
he_IL Hebrew (Israel)
ar Arabic
uz_Arab Uzbek (Arabic)
protocol NotificationType {
var name: Notification.Name { get }
static var name: Notification.Name { get }
var userInfo: [AnyHashable : Any] { get }
init?(notification: Notification?)
}
struct Notifications { }
@JaleelNazir
JaleelNazir / BaseUrl.swift
Created March 29, 2017 14:04 — forked from rajohns08/BaseUrl.swift
iOS / Swift - Base url class for getting from environment
class BaseURL {
class func getFromEnvironment() -> String {
#if DEBUG
return "http://192.168.1.126"
#else
return "https://judgecardx.com"
#endif
}
@JaleelNazir
JaleelNazir / BaseUrl.swift
Created March 29, 2017 14:04 — forked from rajohns08/BaseUrl.swift
iOS / Swift - Base url class for getting from environment
class BaseURL {
class func getFromEnvironment() -> String {
#if DEBUG
return "http://192.168.1.126"
#else
return "https://judgecardx.com"
#endif
}
@JaleelNazir
JaleelNazir / podforceupdate.sh
Created March 18, 2017 18:22 — forked from mbinna/podforceupdate.sh
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@JaleelNazir
JaleelNazir / whatsapp-image-compression
Created February 13, 2017 13:22 — forked from akshay1188/whatsapp-image-compression
Whatsapp like image compression
- (UIImage *)compressImage:(UIImage *)image{
float actualHeight = image.size.height;
float actualWidth = image.size.width;
float maxHeight = 600.0;
float maxWidth = 800.0;
float imgRatio = actualWidth/actualHeight;
float maxRatio = maxWidth/maxHeight;
float compressionQuality = 0.5;//50 percent compression
if (actualHeight > maxHeight || actualWidth > maxWidth) {
@JaleelNazir
JaleelNazir / storyboard-viewcontroller-init.swift
Created January 13, 2017 09:55 — forked from christianhatch/storyboard-viewcontroller-init.swift
A simple UIStoryboard extension to easily instantiate viewcontrollers using Swift type casting. Raw
// Do you often find yourself writing lines of code that look like this?
// let viewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("ViewController") as! ViewController
// Here's a simpler way, using generics and Swift type-casting (as long as the viewcontroller's storyboard identifier is its class name).
// Now you can write: let viewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController() as ViewController
extension UIStoryboard {
func instantiateViewController<T: UIViewController>() -> T {
guard let vc = instantiateViewControllerWithIdentifier(String(T)) as? T else {
fatalError("Could not locate viewcontroller with with identifier \(String(T)) in storyboard.")
}
//
// NSDate+Ago.swift
// Created by Jesse Ziegler on 5/27/15.
// Copyright (c) 2015 Jesse Ziegler. All rights reserved.
//
// http://www.jesseziegler.com
//
// http://github.com/jdziegler/SwiftAgo
//
import Foundation