This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension MainViewController: UITableViewDataSource { | |
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return personData.count | |
} | |
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
let cell = tableView.dequeueReusableCell(withIdentifier: MainTableViewCell.identifier, for: indexPath) as! MainTableViewCell | |
cell.personImage.image = personData[indexPath.row].personImage ?? UIImage(named: "default") | |
cell.personName.text = personData[indexPath.row].personName ?? "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static let sharedInstance = LoadingHUD() | |
if let window = UIApplication.shared.keyWindow { | |
window.addSubview(backgroundView) | |
window.addSubview(popupView) | |
window.addSubview(loadingLabel) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class func show() { | |
let backgroundView = UIView(frame: CGRect.init(x: 0, y: 0, width: 100, height: 100)) | |
let popupView = UIImageView(frame: CGRect.init(x: 0, y: 0, width: 100, height: 100)) | |
popupView.animationImages = LoadingHUD.getAnimationImageArray() | |
popupView.animationDuration = 0.8 | |
popupView.animationRepeatCount = 0 | |
let loadingLabel = UILabel(frame: CGRect.init(x: 0, y: 0, width: 100, height: 100)) | |
loadingLabel.text = "Loading ..." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class func getAnimationImageArray() -> [UIImage] { | |
var animationArray: [UIImage] = [] | |
animationArray.append(UIImage(named: "frame_loading_01")!) | |
animationArray.append(UIImage(named: "frame_loading_02")!) | |
animationArray.append(UIImage(named: "frame_loading_03")!) | |
animationArray.append(UIImage(named: "frame_loading_04")!) | |
animationArray.append(UIImage(named: "frame_loading_05")!) | |
animationArray.append(UIImage(named: "frame_loading_06")!) | |
animationArray.append(UIImage(named: "frame_loading_07")!) | |
animationArray.append(UIImage(named: "frame_loading_08")!) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class func hide() { | |
if let popupView = sharedInstance.popupView, | |
let loadingLabel = sharedInstance.loadingLabel, | |
let backgroundView = sharedInstance.backgroundView { | |
popupView.stopAnimating() | |
backgroundView.removeFromSuperview() | |
popupView.removeFromSuperview() | |
loadingLabel.removeFromSuperview() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let tap = UITapGestureRecognizer(target: self, action: #selector(taped(_:))) | |
self.view.gestureRecognizers = [tap] | |
} | |
@objc func taped(_ sender: UITapGestureRecognizer) { | |
LoadingHUD.show() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import NMapsMap | |
class ViewController: UIViewController, NMFMapViewDelegate { | |
var authState: NMFAuthState! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
var deviceToken: Data? = nil | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class LoginViewController: UIViewController { | |
private let loginButton: KOLoginButton = { | |
let button = KOLoginButton() | |
button.addTarget(self, action: #selector(touchUpLoginButton(_:)), for: .touchUpInside) | |
button.translatesAutoresizingMaskIntoConstraints = false | |
return button | |
}() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class MainViewController: UIViewController { | |
let emailLabel: UILabel = { | |
let label = UILabel() | |
label.translatesAutoresizingMaskIntoConstraints = false | |
return label | |
}() | |