Closed toseefkhilji closed 2 years ago
I'm unable to reproduce this on my machine... I'm on Xcode 13.3, Swift 5.6, and 12.3.1.
Can you try moving the individual .value()
lines onto their own line, though, with a refactoring to variable?
Like this:
extension User: XMLIndexerDeserializable {
static func deserialize(_ node: XMLIndexer) throws -> User {
// these are refactored out... I just did these three
let userId: Int = try node["UserId"].value()
let username: String = try node["UserName"].value()
let email: String = try node["Email"].value()
return try User(userID: userId,
username: username,
email: email,
name: node["UserName"].value(),
role: node["Role"].value(),
roleID: node["RoleID"].value(),
zipCode: node["ZipCode"].value(),
isPaidUser: node["IsPaidUser"].value(),
profileImage: node["ProfileImage"].value())
}
}
Thanks.!!
I have work with custom init method
init?(_ node: XMLIndexer?) {
guard let node = node else { return nil }
do {
userID = try node["UserId"].value()
username = try node["UserName"].value()
email = try node["Email"].value()
name = try node["UserName"].value()
role = try node["Role"].value()
roleID = try node["RoleID"].value()
zipCode = try node["ZipCode"].value()
isPaidUser = try node["IsPaidUser"].value()
profileImage = try node["ProfileImage"].value()
} catch {
print("user init error:\(error))")
return nil
}
}
Getting compile time error if my xml is more than 8 fields
The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
To Reproduce Steps to reproduce the behavior:
Expected behavior No error
Screenshots
Environment:
Additional context Add any other context about the problem here.