Skip to content

Instantly share code, notes, and snippets.

View iRiziya's full-sized avatar
🏠
Working from home

Rinkal C iRiziya

🏠
Working from home
View GitHub Profile
import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet var tableView: UITableView!
var headerView = UIView()
var selectedSections = NSMutableArray()
override func viewDidLoad() {
@iRiziya
iRiziya / CircleChartVC.swift
Created March 10, 2016 10:04
Circle chart(with 2 circles, inner and outer) using SwiftyCircle lib
import UIKit
class CircleChartVC: UIViewController {
let Points:String = "652"
override func viewDidLoad() {
super.viewDidLoad()
let outerCirc = SwiftyCircle(frame: CGRect(x: 100, y: 20, width: 250, height: 250))
@iRiziya
iRiziya / Display grouped data into UITableView or UICollectionView
Created January 30, 2016 14:31
Ex : Display category wise products in tableview
//Datasource
var categories:[String : [Product]] = [
"Category 1": [
Product(pTitle: "Product 1", pRate: "45"),
Product(pTitle: "Product 2", pRate: "55"),
],
"Category 2": [
Product(pTitle: "Product 3", pRate: "3"),
Product(pTitle: "Product 4", pRate: "33"),
],
Option 1 :
override func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) {
let offset:CGPoint = scrollView.contentOffset;
let bounds:CGRect = scrollView.bounds;
let size:CGSize = scrollView.contentSize;
let inset:UIEdgeInsets = scrollView.contentInset;
let y:CGFloat = offset.y + bounds.size.height - inset.bottom;
let h:CGFloat = size.height;
@iRiziya
iRiziya / Alamofire+UIImage.swift
Created September 29, 2015 05:43 — forked from winzig/Alamofire+UIImage.swift
Ray Wenderlich's UIImage serializer for Alamofire, updated for Alamofire 2.0 and Swift 2
extension Alamofire.Request {
/** Response serializer for images from: http://www.raywenderlich.com/85080/beginning-alamofire-tutorial */
class func imageResponseSerializer() -> GenericResponseSerializer<UIImage> {
return GenericResponseSerializer { request, response, data in
guard let validData = data else {
let failureReason = "Data could not be serialized. Input data was nil."
let error = Error.errorWithCode(.DataSerializationFailed, failureReason: failureReason)
return .Failure(data, error)