Skip to content

Instantly share code, notes, and snippets.

View AshvinGudaliya's full-sized avatar

Ashvin Gudaliya AshvinGudaliya

View GitHub Profile
@AshvinGudaliya
AshvinGudaliya / AGUploadImageWebServices.swift
Last active January 5, 2019 09:56
Multipart file/Images upload with parameters in Swift
//
// AGUploadImageWebServices.swift
// BaseProject
//
// Created by AshvinGudaliya on 27/02/18.
// Copyright © 2018 AshvinGudaliya. All rights reserved.
//
import UIKit
@AshvinGudaliya
AshvinGudaliya / AGRoundCornersView.swift
Created March 9, 2018 06:36
To set a Rounded Corners in all View control in swift
class AGRoundCornersView: UIView {
fileprivate var roundCornerRadius: CGFloat = 0.0
fileprivate var cornerRect: UIRectCorner = []
fileprivate var cornerCustom: [AGCornerTypes] = []
enum AGCornerTypes {
case topLeft(CGFloat)
case topRight(CGFloat)
case bottomLeft(CGFloat)
@AshvinGudaliya
AshvinGudaliya / AGCodableStorage.swift
Created April 26, 2018 13:28
Load and store a Codable Class in file
//
// AGCodableStorage.swift
// BaseProject
//
// Created by thirdeyes Infotech Pvt Ltd on 05/04/18.
// Copyright © 2018 AshvinGudaliya. All rights reserved.
//
import UIKit
@AshvinGudaliya
AshvinGudaliya / ChatCollectionViewFlowLayout.swift
Created May 10, 2018 12:46
A subclass of UICollectionViewFlowLayout to get chat behavior without turning collection view upside-down. This layout is written in Swift 3 and absolutely usable with RxSwift and RxDataSources because UI is completely separated from any logic or binding.
import UIKit
class ChatCollectionViewFlowLayout: UICollectionViewFlowLayout {
private var topMostVisibleItem = Int.max
private var bottomMostVisibleItem = -Int.max
private var offset: CGFloat = 0.0
private var visibleAttributes: [UICollectionViewLayoutAttributes]?
@AshvinGudaliya
AshvinGudaliya / AGContentMIMEType.swift
Last active December 19, 2019 16:25
ContentMIMEType Upload Images, Audio & Video, Text file, Google Drive, Directory, Archive and Binary, Documents all content MIME Types listed here in swift
import UIKit
/// Holds file MIME, and introduces selected type MIME as constants
public struct AGContentMIMEType: RawRepresentable, Hashable, Equatable {
public var rawValue: String
public typealias RawValue = String
public init(rawValue: String) {
self.rawValue = rawValue
}
@AshvinGudaliya
AshvinGudaliya / UITableView+RefreshControl.swift
Last active July 17, 2018 11:10
PullToRefresh using UIRefreshControl directly property type.
import UIKit
extension UITableView {
private struct AssociatedKeys {
static var ActionKey = "UIRefreshControlActionKey"
}
private class ActionWrapper {
let action: RefreshControlAction
init(action: @escaping RefreshControlAction) {
@AshvinGudaliya
AshvinGudaliya / AGTapGestureClosure.swift
Created July 17, 2018 11:10
UITapGestureRecognizer directly in UIView extension
import UIKit
open class AGTapGestureClosure: UITapGestureRecognizer {
private var tapAction: ((UITapGestureRecognizer) -> Void)?
public override init(target: Any?, action: Selector?) {
super.init(target: target, action: action)
}
public convenience init (
@AshvinGudaliya
AshvinGudaliya / AGAutocompletePlaceTextfield.swift
Last active April 10, 2023 07:02
A simple subclass of UITextField for getting auto complete place search from Google Places.
//
// AGAutocompletePlaceTextfield.swift
// AGAutocompletePlaceTextfield
//
// Created by Arpit Jain on 28/07/17.
// Copyright © 2017 Arpit Jain. All rights reserved.
//
import UIKit
import GooglePlaces
@AshvinGudaliya
AshvinGudaliya / TapticEngine.swift
Last active September 10, 2018 09:49
How to generate haptic feedback with UIFeedbackGenerator.
//
// TapticEngine.swift
// AGBaseProject
//
// Created by Ashvin Gudaliya on 2017/04/09.
//
//
import UIKit
@AshvinGudaliya
AshvinGudaliya / AGAudioRecorder.swift
Last active June 2, 2023 08:21
Simple Audio recorder and player in swift 4
//
// AGAudioRecorder.swift
// BaseProject
//
// Created by AshvinGudaliya on 17/09/18.
// Copyright © 2018 AshvinGudaliya. All rights reserved.
//
import UIKit
import AVFoundation