A tool to translate .xib
and .storyboard
XML into Swift models.
Using Cocoapods:
Simply add the following line to your Podfile:
pod 'IBDecodable'
Using Swift Package Manager:
To include IBDecodable into a Swift Package Manager package, add it to the dependencies attribute defined in your Package.swift
file.
dependencies: [
.Package(url: "https://github.com/IBDecodable/IBDecodable.git", majorVersion: <majorVersion>, minor: <minor>)
]
From file url:
let file = try StoryboardFile(url: fileURL)
From string content:
let parser = InterfaceBuilderParser()
let storyboardDocument = try parser.parseStoryboard(xml: "<?xml ... ")
if let scenes = file.document.scenes {
for scene in scenes {
..
}
}
if let resources = file.document.resources {
for resource in resources {
 resource.resource // .. `NamedColor`, Ìmage
}
}
From file url:
let file = try XibFile(url: fileURL)
From string content:
let parser = InterfaceBuilderParser()
let xibDocument = try parser.parseXib(xml: "<?xml ... ")