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:
2026-09-18 13:15:08 +00:00
committed by javier
parent d0a561b91f
commit c5037dd716
105 changed files with 1390 additions and 1397 deletions
@@ -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
}