1234567891011121314151617181920212223242526272829303132 |
- //
- // OptionalUtil.swift
- // HCQuanfangtong
- //
- // Created by Apple on 2022/2/24.
- // Copyright © 2022 Jyp. All rights reserved.
- //
- import Foundation
- protocol AnyOptional {
- var isNil : Bool {get}
- var isNotNil : Bool{get}
- }
- extension Optional : AnyOptional{
- var isNil : Bool{
- self == nil
- }
- var isNotNil: Bool{
- self != nil
- }
- }
- extension Optional where Wrapped == String{
- var isEmptyStr : Bool{
- self.isNil || self!.isEmpty
- }
- var isNotEmptyStr: Bool{
- !self.isEmptyStr
- }
- }
|