Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 1.16 KB

ADVANCED-OPTIONS.md

File metadata and controls

31 lines (23 loc) · 1.16 KB

Advanced Options

Enable Debug Logging

During development, you may want to see what strada-ios is doing behind the scenes. To enable debug logging, call Strada.config.debugLoggingEnabled = true. Debug logging should always be disabled in your production app. For example:

#if DEBUG
    Strada.config.debugLoggingEnabled = true
#endif

Using a custom JSON encoder or decoder

By default, strada-ios uses JSONEncoder and JSONDecoder to encode/decode Message.data with your own data models that implement the Codeable/Decodable/Encodable protocols.

If you'd like to customize the encoding/decoding strategy, you can configure this in your app:

let encoder = JSONEncoder()
encoder.keyEncodingStrategy = .convertToSnakeCase

// Configure your encoder as Strada's automatic encoder
Strada.config.jsonEncoder = encoder
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase

// Configure your decoder as Strada's automatic decoder
Strada.config.jsonDecoder = decoder