document SocketPacket.PacketType

This commit is contained in:
Erik Little 2017-10-01 10:52:30 -04:00
parent 43907a4001
commit 665cfef8d3
No known key found for this signature in database
GPG Key ID: 4930B7C5FBC1A69D

View File

@ -27,13 +27,6 @@ import Foundation
/// A struct that represents a socket.io packet.
public struct SocketPacket : CustomStringConvertible {
// MARK: PacketType enum
/// The type of packets.
public enum PacketType: Int {
case connect, disconnect, event, ack, error, binaryEvent, binaryAck
}
// MARK: Properties
private static let logType = "SocketPacket"
@ -165,6 +158,36 @@ public struct SocketPacket : CustomStringConvertible {
}
}
public extension SocketPacket {
// MARK: PacketType enum
/// The type of packets.
public enum PacketType: Int {
// MARK: Cases
/// Connect: 0
case connect
/// Disconnect: 1
case disconnect
/// Event: 2
case event
/// Ack: 3
case ack
/// Error: 4
case error
/// Binary Event: 5
case binaryEvent
/// Binary Ack: 6
case binaryAck
}
}
extension SocketPacket {
private static func findType(_ binCount: Int, ack: Bool) -> PacketType {
switch binCount {