# ResponseAPDU

    @objcMembers
    public class ResponseAPDU : BaseClass

SmartCardIO - ResponseAPDU Class

A response APDU as defined in ISO/IEC 7816-4. It consists of a conditional body and a two byte trailer. This class does not attempt to verify that the APDU encodes a semantically valid response.

- `init(apdu:)`

  Initialiser; constructs a ResponseAPDU from a byte array containing the complete APDU contents (header and body).

  Throws

  StatusCode.invalidParameter if the APDU size is smaller than 2

  #### Declaration

  Swift

      @nonobjc
      public init(apdu: [UInt8]) throws

  #### Parameters

  `apdu` | byte array containing the complete APDU contents (header and body).

- `init(apduArray:)`

  Initialiser; constructs a ResponseAPDU from a byte array containing the complete APDU contents (header and body).

  Throws

  StatusCode.invalidParameter if the APDU size is smaller than 2

  #### Declaration

  Swift

      @objc
      public init(apduArray: [UInt8]) throws

  #### Parameters

  `apduArray` | byte array containing the complete APDU contents (header and body).

- `init(apdu:)`

  constructs a ResponseAPDU from Data containing the complete APDU contents (header and body).

  Throws

  StatusCode.invalidParameter if the APDU size is smaller than 2

  #### Declaration

  Swift

      public init(apdu: Data) throws

  #### Parameters

  `apdu` | Data containing the complete APDU contents (header and body).

- `getBytes()`

  Returns a copy of the bytes contained in this APDU.

  #### Declaration

  Swift

      public func getBytes() -> Data

  #### Return Value

  Data containing the APDU

- `getData()`

  Returns a copy of the data bytes in the response body.

  #### Declaration

  Swift

      public func getData() -> Data

  #### Return Value

  APDU data bytes

- `getNr()`

  Returns the number of data bytes in the response body (Nr) or 0 if this APDU has no body.

  #### Declaration

  Swift

      public func getNr() -> UInt32

  #### Return Value

  Number of data bytes in the response body (Nr)

- `getSW()`

  Returns the value of the status bytes SW1 and SW2 as a single status word SW.

  #### Declaration

  Swift

      public func getSW() -> UInt16

  #### Return Value

  Status bytes SW1 and SW2 as a single status word SW.

- `getSW1()`

  Returns the value of the status byte SW1 as a value between 0 and 255.

  #### Declaration

  Swift

      public func getSW1() -> UInt8

  #### Return Value

  status byte SW1 as a value between 0 and 255

- `getSW2()`

  Returns the value of the status byte SW2 as a value between 0 and 255.

  #### Declaration

  Swift

      public func getSW2() -> UInt8

  #### Return Value

  status byte SW2 as a value between 0 and 255

- `toString()`

  Returns a string representation of the response APDU

  #### Declaration

  Swift

      public func toString() -> String

  #### Return Value

  String representation of the response APDU

Copyright (c) 2018-2024, AB Circle Ltd. All rights reserved.

Generated by jazzy ♪♫ v0.14.3, a Realm project.