Encoding & Decoding
MBurgerSwift
has a built in system that can be used to init your custom constructs. You have only to make your construct conform to MBDecodable
protocol.
For example a News
that's reflecting a newsfeed block in MBurger:
And call the decode
function of MBDecoder
to create and populate an array of news like this:
The DecoderCodingKey needs to match to the name
of the element in the MBurger block(e.g. if the element on the dashboard is called Title the decoder key needs to be Title):
You can find a complete example in the Example project.
Last updated