Swift 6.4 migration and exhancements (#1)
This PR contains the work done to update the library and the attached example project to use the Swift 6.4 computer as a minimum supported version and also, to use the latest features introduced in it. Reviewed-on: #1 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #1.
This commit is contained in:
@@ -1,31 +1,47 @@
|
||||
internal import CPlaydate
|
||||
|
||||
extension Network {
|
||||
/// A network error code (`PDNetErr`).
|
||||
/// A network error. Wraps the negative `PDNetErr` codes.
|
||||
public enum NetError: Int32, Swift.Error, Sendable {
|
||||
/// `NET_NO_DEVICE`.
|
||||
case noDevice = -1
|
||||
/// `NET_BUSY`.
|
||||
case busy = -2
|
||||
/// `NET_WRITE_ERROR`.
|
||||
case writeError = -3
|
||||
/// `NET_WRITE_BUSY`.
|
||||
case writeBusy = -4
|
||||
/// `NET_WRITE_TIMEOUT`.
|
||||
case writeTimeout = -5
|
||||
/// `NET_READ_ERROR`.
|
||||
case readError = -6
|
||||
/// `NET_READ_BUSY`.
|
||||
case readBusy = -7
|
||||
/// `NET_READ_TIMEOUT`.
|
||||
case readTimeout = -8
|
||||
/// `NET_READ_OVERFLOW`.
|
||||
case readOverflow = -9
|
||||
/// `NET_FRAME_ERROR`.
|
||||
case frameError = -10
|
||||
/// `NET_BAD_RESPONSE`.
|
||||
case badResponse = -11
|
||||
/// `NET_ERROR_RESPONSE`.
|
||||
case errorResponse = -12
|
||||
/// `NET_RESET_TIMEOUT`.
|
||||
case resetTimeout = -13
|
||||
/// `NET_BUFFER_TOO_SMALL`.
|
||||
case bufferTooSmall = -14
|
||||
/// `NET_UNEXPECTED_RESPONSE`.
|
||||
case unexpectedResponse = -15
|
||||
/// `NET_NOT_CONNECTED_TO_AP`.
|
||||
case notConnectedToAP = -16
|
||||
/// `NET_NOT_IMPLEMENTED`.
|
||||
case notImplemented = -17
|
||||
/// `NET_CONNECTION_CLOSED`.
|
||||
case connectionClosed = -18
|
||||
/// An error code not covered by `PDNetErr`.
|
||||
/// A code not in `PDNetErr`.
|
||||
case unknown = 1
|
||||
|
||||
/// Creates an error from the C code, or `.unknown` for
|
||||
/// unrecognized codes.
|
||||
init(_ error: PDNetErr) {
|
||||
self = NetError(rawValue: Int32(error.rawValue)) ?? .unknown
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
extension Network {
|
||||
/// The device's wifi status.
|
||||
/// The device's wifi status. Wraps `WifiStatus`.
|
||||
public enum WifiStatus: UInt32, Sendable {
|
||||
case notConnected = 0
|
||||
case connected = 1
|
||||
/// A connection was attempted but no configured access point was
|
||||
/// available.
|
||||
/// A connection was attempted but no configured access point was available.
|
||||
case notAvailable = 2
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user