How to set section header/footer margins in Eureka without creating custom classes
<p>I am using the Eureka framework and recently added code to allow for edge to edge cell separators. With this, all the form elements need to have a margin defined otherwise they start at the very left of the screen.</p>

<p>Is there a way to adjust the left/right margins of the Section header/footer similarly to a cell? I am trying to avoid using custom classes for every section/header title.</p>

<p>I tried looking at the source code to see how the view is created, but I don't see anywhere where it defines the x-coordinate or left/right margins, etc. I also don't see any properties that I could set to accomplish this.</p>

<p>Any help would be greatly appreciated!</p>

<pre><code>            +++ Section(){section in
                var footer = HeaderFooterView&lt;UITableViewHeaderFooterView&gt;(.Class)
                footer.onSetupView = {view, _, _ in
                    view.preservesSuperviewLayoutMargins = false
                    view.layoutMargins.left = 50
                    view.layoutMargins.right = 50
                    view.contentView.preservesSuperviewLayoutMargins = false
                    view.contentView.layoutMargins.top = 10
                    view.contentView.layoutMargins.left = 50
                    view.textLabel?.text = "This is a test footer message."
                    view.textLabel?.layoutMargins.top = 10
                    view.textLabel?.font = UIFont.preferredFontForTextStyle("Footnote")
                }
                section.header = HeaderFooterView&lt;ALogoView&gt;(HeaderFooterProvider.Class)
                section.footer = footer
                }
</code></pre>

<p>Edit: I've tried the above, but it does not work. If you put in a long string, it moves up into the parent section's rows.</p>

<p>Edit2: I've come up with the following</p>

<pre><code>class GenericHeader: UIView {

override init(frame: CGRect) {
    super.init(frame: frame)
    self.preservesSuperviewLayoutMargins = false
    let textView = UILabel()
    textView.frame = CGRect(x: 0, y: 0, width: UIScreen.mainScreen().bounds.width - 30, height: 20 )
    textView.text = "This is  a very very very long title, This is  a very very very long title, This is  a very very very long title, This is  a very very very long title, This is  a very very very long title, This is  a very very very long title Let's add some more stuff here to see how it handles."
    textView.numberOfLines = 0
    textView.textAlignment = .Justified
    textView.font = UIFont.preferredFontForTextStyle(UIFontTextStyleBody)
    textView.textColor = UIColor(red:0.47, green:0.47, blue:0.49, alpha:1.0)
    textView.frame = textView.bounds
    textView.sizeToFit()
    self.addSubview(textView)
    //self.frame = CGRect(x: -15, y: -3, width: textView.bounds.width - 16, height: textView.bounds.height)
    self.bounds = CGRect(x: -15, y: -3, width: textView.bounds.width - 16, height: textView.bounds.height)
}

required init?(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
}
}
</code></pre>

<p>I'm using this in my form: </p>

<pre><code>+++ Section() {
    $0.header = HeaderFooterView&lt;GenericHeader&gt;(HeaderFooterProvider.Class)
    $0.footer = HeaderFooterView&lt;GenericFooter&gt;(HeaderFooterProvider.Class)
}
</code></pre>

<p>How can I pass along a string when the Header/Footer classes are instantiated so that I don't have to write a million different classes/views with different text?</p>