SLIP is a lightweight package for the SLIP packets, as documented in RFC 1055. It defines encoding and decoding and handles double-ended SLIP encoded packets.
Installation
SLIP is available as a Swift Package Manager package. You can add it to your project from Xcode’s “Swift Packages” option in the File menu.
SLIP defines a global, single struct access for the functionality of the package. Start by creating an instance:
let packet = SLIP.Packet(<#T##YourData#>)
Then use that instance to encode the packet.
let encoded = packet.encoded
Or decode it
let decoded = try? packet.decoded
Error Hanlding
Contrary to the reference implementation described in RFC 1055, which chooses to essentially ignore protocol errors, the decoded method in the SLIP package use a SLIPError.protocolError error to indicate protocol errors, i.e. SLIP packets with invalid byte sequences.
You can optionally opt-in to ignore decoding errors by specifying ignoresError in the Packet(_:ignoresProtocolError:) initializer.
SLIP
SLIP is a lightweight package for the SLIP packets, as documented in RFC 1055. It defines encoding and decoding and handles double-ended SLIP encoded packets.
Installation
SLIP is available as a Swift Package Manager package. You can add it to your project from Xcode’s “Swift Packages” option in the File menu.
Usage
SLIP defines a global, single struct access for the functionality of the package. Start by creating an instance:
Then use that instance to encode the packet.
Or decode it
Error Hanlding
Contrary to the reference implementation described in RFC 1055, which chooses to essentially ignore protocol errors, the
decoded
method in the SLIP package use aSLIPError.protocolError
error to indicate protocol errors, i.e. SLIP packets with invalid byte sequences.You can optionally opt-in to ignore decoding errors by specifying
ignoresError
in thePacket(_:ignoresProtocolError:)
initializer.