title: Swift4 displaying Parser result in an NSOutlineView
body: <p>I wrote a TLV parser that returns results like the following tag length value:</p>
  
  <pre><code> &lt;e1&gt; 53 &lt;9f1e0831 36303231 343337ef…&gt; 
       &lt;9f1e&gt; 8 &lt;31363032 31343337&gt; 
       &lt;ef&gt; 18 &lt;df0d084d 3030302d 4d5049df 7f04312d 3232&gt; 
           &lt;df0d&gt; 8 &lt;4d303030 2d4d5049&gt; 
           &lt;df7f&gt; 4 &lt;312d3232&gt; 
       &lt;ef&gt; 20 &lt;df0d0b4d 3030302d 54455354 4f53df7f 03362d35&gt; 
           &lt;df0d&gt; 11 &lt;4d303030 2d544553 544f53&gt; 
           &lt;df7f&gt; 3 &lt;362d35&gt;
  </code></pre>
  
  <p>I want to display this in an OutlineView, but I'm not familiar how the store object should look like and how to fill it up. Somehow it needs to be something like below:</p>
  
  <pre><code>class Node: NSObject {
      var isConstructed = false
      var tag = „Tag“
      var length = 0
      var value = „Value“
      var children = [Node]()
      weak var parent: Node?
  
      override init() {
         super.init()
      }
  
  
      init(tag: String) {
        self.tag = tag
      }
      init(length: Int) {
        self.length = length
      }
      init(value: String) {
        self.value = value
      }
      init(isConstructed: Bool) {
        self.isConstructed = isConstructed
      }
  
      func isLeaf() -&gt; Bool {
        return children.isEmpty
      }
  }
  </code></pre>
  
  <p>The TLV parser demo
  <a href="https://github.com/frcocoatst/ParseTLV_swift" rel="nofollow noreferrer">TLVparser</a></p>
  
  <p>Should look like this:
  <a href="https://i.stack.imgur.com/Q2mq3.png" rel="nofollow noreferrer">TLV parse result in NSOutlineView</a></p>