Skip to content

Commit

Permalink
add new version and some new extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonL committed Jul 11, 2019
1 parent 9ce5835 commit 6579b65
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion TymateSwiftExtensions.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |spec|

spec.name = "TymateSwiftExtensions"
spec.version = "0.0.1"
spec.version = "0.0.2"
spec.summary = "A CocoaPods library written in Swift"

spec.description = <<-DESC
Expand Down
Binary file not shown.
26 changes: 13 additions & 13 deletions TymateSwiftExtensions/UIImageViewExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
//

import Foundation
import Kingfisher
//import Kingfisher

public extension UIImageView {
func loadImage(withUrl url: String?,
andPlaceHolder placeHolder: UIImage? = nil, preloadWithPlaceHolder: Bool = true) {
if preloadWithPlaceHolder {
self.image = placeHolder ?? UIImage(named: "placeholder")
}
guard let urlString = url, let url = URL(string: urlString) else {
self.image = placeHolder ?? UIImage(named: "placeholder")
return
}
let resource = ImageResource(downloadURL: url, cacheKey: url.path)
self.kf.setImage(with: resource, placeholder: placeHolder)
}
// func loadImage(withUrl url: String?,
// andPlaceHolder placeHolder: UIImage? = nil, preloadWithPlaceHolder: Bool = true) {
// if preloadWithPlaceHolder {
// self.image = placeHolder ?? UIImage(named: "placeholder")
// }
// guard let urlString = url, let url = URL(string: urlString) else {
// self.image = placeHolder ?? UIImage(named: "placeholder")
// return
// }
// let resource = ImageResource(downloadURL: url, cacheKey: url.path)
// self.kf.setImage(with: resource, placeholder: placeHolder)
// }

func designRounded(radius: Int) {
self.layer.cornerRadius = CGFloat(radius)
Expand Down
22 changes: 11 additions & 11 deletions TymateSwiftExtensions/UIViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@

import Foundation
import UIKit
import Toast_Swift
//import Toast_Swift

extension UIViewController {

func showToast(title: String, subtitle: String? = nil, image: UIImage? = nil, duration: TimeInterval = 3, position: ToastPosition = .bottom, view: UIView? = nil) {
let optionnalShowingView = view ?? self.tabBarController?.view ?? self.view
guard let showingView = optionnalShowingView else {return}

if let subtitle = subtitle, subtitle.contains("offline") {
showingView.makeToast(NSLocalizedString("Pas de connexion internet. Vérifiez votre connexion et revenez sur la page.", comment: "Error internet connection"), duration: 8, position: position, title: title, image: UIImage.init(named: "icLostConnexion"), completion: nil)
} else {
showingView.makeToast(subtitle, duration: duration, position: position, title: title, image: image, completion: nil)
}
}
// func showToast(title: String, subtitle: String? = nil, image: UIImage? = nil, duration: TimeInterval = 3, position: ToastPosition = .bottom, view: UIView? = nil) {
// let optionnalShowingView = view ?? self.tabBarController?.view ?? self.view
// guard let showingView = optionnalShowingView else {return}
//
// if let subtitle = subtitle, subtitle.contains("offline") {
// showingView.makeToast(NSLocalizedString("Pas de connexion internet. Vérifiez votre connexion et revenez sur la page.", comment: "Error internet connection"), duration: 8, position: position, title: title, image: UIImage.init(named: "icLostConnexion"), completion: nil)
// } else {
// showingView.makeToast(subtitle, duration: duration, position: position, title: title, image: image, completion: nil)
// }
// }
}

0 comments on commit 6579b65

Please sign in to comment.