Merged PR 236148: MSHUD - better support for Objective-C (Part 2)

`MSHUDParams`:
- new empty `init` for Objective-C;
- `caption`, `isBlocking`, `isPersistent` are now public and writable;
- new `image` property

Related work items: #690424
This commit is contained in:
Vlad Filyakov 2019-02-25 21:59:11 +00:00
Родитель 1b0def31fe
Коммит 88da6349ca
1 изменённых файлов: 25 добавлений и 3 удалений

Просмотреть файл

@ -13,10 +13,32 @@ import UIKit
// MARK: - MSHUDParams
public class MSHUDParams: NSObject {
fileprivate let caption: String
@objc open var caption: String
@objc open var image: UIImage? {
get {
if case let .custom(image) = hudType {
return image
} else {
return nil
}
}
set {
if let image = newValue {
hudType = .custom(image: image)
} else {
hudType = .activity
}
}
}
@objc open var isBlocking: Bool
@objc open var isPersistent: Bool
fileprivate var hudType: MSHUDType
fileprivate let isBlocking: Bool
fileprivate let isPersistent: Bool
// For Objective-C
@objc public override convenience init() {
self.init(caption: "", image: nil, isPersistent: true, isBlocking: true)
}
@objc public convenience init(caption: String = "", image: UIImage? = nil, isPersistent: Bool = true, isBlocking: Bool = true) {
if let image = image {