Third party libraries commonly used by IOS swift

Time:2022-5-6

All developers know that don’t build wheels repeatedly. To improve work efficiency, many people have built wheels, which are easy to use and have few bugs. This article is to sort out the third-party libraries that can be used well. I hope it can help you, help yourself and update them slowly. If there are useful libraries, please leave a message in the comments and add them slowly

  • SMS verification code

usemob_smssdkSend the verification code and claim that it is permanently free and has no use restrictions. It feels very good to use. It doesn’t cost money anyway. The only roast has an official name, and it is almost impossible for individual users to customize the template. If the number of users is large, don’t use it. Spend some money on a formal one.

  • On some icon cut graphs

If there is no art and design, where can I get good-looking pictures? The direct thought is to decompress other people’s IPA and obtain some resources (it’s too obvious and not good-looking). I use Alibaba vector icon libraryhttp://www.iconfont.cn, there are abundant resources here. Some basic icons can be used directly.

Network request framework, the library that app must reference

Address:https://github.com/Alamofire/Alamofire
Other parsing:https://www.jianshu.com/p/4381fe8e10b6

Examples

struct Login: Encodable {
    let email: String
    let password: String
}

let login = Login(email: "[email protected]", password: "testPassword")

AF.request("https://httpbin.org/post",
           method: .post,
           parameters: login,
           encoder: JSONParameterEncoder.default).response { response in
    debugPrint(response)
}

Open the controller and router route in a linked way

Address:https://github.com/devxoul/URLNavigator
Examples

Navigator.push("myapp://user/123")
Navigator.present("myapp://post/54321", wrap: UINavigationController.self)
Navigator.open("myapp://alert?title=Hello&message=World")

Other parsing:https://blog.csdn.net/jancywen/article/details/105110685
https://www.jianshu.com/p/3bbabe0e93b0

Handyjson is a JSON serialization / deserialization library used in swift language. Must use

https://github.com/alibaba/HandyJSON
Deserialization 👇🏻

class BasicTypes: HandyJSON {
    var int: Int = 2
    var doubleOptional: Double?
    var stringImplicitlyUnwrapped: String!

    required init() {}
}

let jsonString = "{\"doubleOptional\":1.1,\"stringImplicitlyUnwrapped\":\"hello\",\"int\":1}"
if let object = BasicTypes.deserialize(from: jsonString) {
    print(object.int)
    print(object.doubleOptional!)
    print(object.stringImplicitlyUnwrapped)
}

Serialization 👇🏻

let object = BasicTypes()
object.int = 1
object.doubleOptional = 1.1
object.stringImplicitlyUnwrapped = “hello"

print(object.toJSON()!) // serialize to dictionary
print(object.toJSONString()!) // serialize to JSON string
print(object.toJSONString(prettyPrint: true)!) // serialize to pretty JSON string
  • ObjectMapper -swift

JSON to model, model to JSON, required

https://github.com/tristanhimmelman/ObjectMapper

let user = User(JSONString: JSONString)
let JSONString = user.toJSONString(prettyPrint: true)

Recommended Today

Crash tracking journey of IOS development (I)

Preface: Recently, I encountered a crash blood disaster caused by crash in daily development. In a release in early May, the crash rate of the app developed by the author was directly increased from one thousand to nearly two thousand. At that time, the project leader just needed to report the relevant situation of project […]