Skip to content

Instantly share code, notes, and snippets.

View ahmdmau's full-sized avatar
🙏
Focusing

Ahmad Maulana ahmdmau

🙏
Focusing
View GitHub Profile
@ahmdmau
ahmdmau / ExtensionFLAnimatedImage.swift
Created February 18, 2021 13:48
Extension FLAnimatedImage for loading gif in asset
import UIKit
import FLAnimatedImage
extension FLAnimatedImage {
convenience init (gifResource: String) {
if let data = NSDataAsset(name: gifResource) {
self.init(animatedGIFData: data.data)
} else {
self.init(animatedGIFData: nil)
}
@ahmdmau
ahmdmau / LoadingButton.swift
Created February 18, 2021 13:47
Custom loading button with custom state with FLAnimatedImage (for showing gif data)
import UIKit
import FLAnimatedImage
@IBDesignable
open class LoadingButton: UIButton {
// MARK: - General Properties
public enum State: Int {
case initial
case loading
case finished
@ahmdmau
ahmdmau / ViewController.swift
Created March 13, 2020 05:24
Change Force Outlet With Delayed
final class ViewController: UIViewController{
@Delayed @objc private var usernameField: UITextField
}
@ahmdmau
ahmdmau / Alamofire+Rx.swift
Created February 16, 2020 15:32 — forked from mminer/Alamofire+Rx.swift
Example of Alamofire RxSwift response serialization extension.
import Alamofire
import RxSwift
extension Request: ReactiveCompatible {}
extension Reactive where Base: DataRequest {
func responseJSON() -> Observable<Any> {
return Observable.create { observer in
let request = self.base.responseJSON { response in