To run the example project, clone the repo, and run pod install
from the Example directory first.
- iOS 11
- Swift 5
- Xcode 12
EasySwiftUIKit is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'EasySwiftUIKit'
or
pod 'EasySwiftUIKit', '~> 1.0'
import EasySwiftUIKit
//stringDate.dateFormat(toFormat: "yyyy-MM-dd HH:mm:ss", withFormat: "MMM dd,yyyy")
//Return formatted date in string form
let date = "2021-03-28 12:24:26".dateFormat(toFormat: "yyyy-MM-dd HH:mm:ss", withFormat: "MMM dd,yyyy")
or
//stringDate.dateToString(toFormat: "yyyy-MM-dd HH:mm:ss", withFormat: "MMM dd,yyyy")
//Return formatted date in string form
let date = "2021-02-28 12:24:26".dateToString(toFormat: "yyyy-MM-dd HH:mm:ss", withFormat: "MMM dd,yyyy")
or
//stringDate.dateToDate(toFormat: "yyyy-MM-dd HH:mm:ss", withFormat: "MMM dd,yyyy")
//Return formatted date in date form
let date = "2021-02-28 12:24:26".dateToDate(toFormat: "yyyy-MM-dd HH:mm:ss", withFormat: "MMM dd,yyyy")
let format = DateFormat()
.year(.fourDigits)
.separator(.dash)
.month(.zeroPaddedNumber)
.separator(.dash)
.day(.zeroPaddedNumber)
.string("T")
.hour(.zeroPaddedTwentyFourHour)
.separator(.colon)
.minute(.zeroPaddedNumber)
.separator(.colon)
.second(.zeroPaddedNumber)
.timezone(.RFC822)
let formatter = DateFormatter()
formatter.setDateFormat(format)
print(format.dateFormat) //yyyy-MM-dd'T'HH:mm:ssZ
//format.dateFormat - return the date format as like: yyyy-MM-dd'T'HH:mm:ssZ
let jsonResult = JSONParser.parseJSON(dataModel: [DataModel].self, jsonData: response)
switch jsonResult {
case .success(let result):
for item in result {
}
case .failure(let error):
print("Error: \(error)")
}
//Individual/single data model
let modelData = ModelData(name: "Rz Rasel", data: QuantumValue.string("Rashed - Uz - Zaman"))
//Usages of individual/single data model
let strValue = modelData.data.stringValue
or
//struct data model
struct ModelData: Decodable {
var name: String!
var data: QuantumValue!
}
//List of data model
let modelDataList = [
ModelData(name: "Rz Rasel", data: QuantumValue.int(1)),
ModelData(name: "Rz Rasel", data: QuantumValue.string("Rashed - Uz - Zaman"))
]
//Usages of list of data model
for item in modelDataList {
//Usages of QuantumValue data
let intVal = item.data.intValue
let strVal = item.data.stringValue
//Usages of QuantumValue data in data safety
let safeIntVal = item.data?.intValue
let safeStrVal = item.data?.stringValue
}
Md. Rashed - Uz - Zaman (Rz Rasel)
EasySwiftUIKit is available under the MIT license. See the LICENSE file for more info.