Skip to content

A tool to translate xib and storyboard XML into Swift models.

License

Notifications You must be signed in to change notification settings

kodika/IBDecodable

 
 

Repository files navigation

IBDecodable

Build Status Swift 5.0 Contributors Forks Stargazers Issues MIT License

A tool to translate .xib and .storyboard XML into Swift models.

Installing

Using Cocoapods:

Simply add the following line to your Podfile:

pod 'IBDecodable'

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>)
]

Parse Storyboard

From file url:

let file = try StoryboardFile(url: fileURL)

From string content:

let parser = InterfaceBuilderParser()
let storyboardDocument = try parser.parseStoryboard(xml: "<?xml ... ")

Browse the storyboard scene

if let scenes = file.document.scenes {
  for scene in scenes {
    ..
  }
}

Get the storyboard resources

if let resources = file.document.resources {
  for resource in resources {
    resource.resource // .. `NamedColor`, Ìmage
  }
}

Parse Xib

From file url:

let file = try XibFile(url: fileURL)

From string content:

let parser = InterfaceBuilderParser()
let xibDocument = try parser.parseXib(xml: "<?xml ... ")

About

A tool to translate xib and storyboard XML into Swift models.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 99.9%
  • Ruby 0.1%