xmartlabs/Eureka

TableView IBOutlet not showing in Storyboard

bachirelkhoury opened this issue ยท 9 comments

I'm having similar problem to #116 where my tableView goes under the NavigationBar.
I am supposed to connect the tableView to the IBOutlet but that outlet doesn't show up in the Storyboard:

main_storyboard

The class doesn't appear in the Custom class dropdown either, so seems Storyboard can't seem to identify Eureka's FromViewController as a subclass of UIViewController:

main_storyboard_and_tableview_iboutlet_not_showing_in_storyboard_ issue__295 _xmartlabs_eureka

But if I type the class anyway "ProfileViewController", and compile, it all works fine and form is displayed.
The only problem is similar to #116 where my tableView goes under the NavigationBar, but no way to connect the IBOutlet!

Xcode: 7.2.1
Eureka: 1.4.1
Installed via Carthage

Here's what the code looks like:

import UIKit
import Eureka

class ProfileViewController: FormViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        form = Section() 
            <<< NameRow() {
                $0.title = "First name:"
                $0.value = userModel?.firstName
            }.cellUpdate { cell, row in
                cell.textField.textAlignment = .Left
            }
            <<< NameRow() {
                $0.title = "Last name:"
                $0.value = userModel?.lastName
            }.cellUpdate { cell, row in
                cell.textField.textAlignment = .Left
            }
            <<< EmailRow() {
                $0.title = "Email:"
                $0.value = userModel?.email
            }.cellUpdate { cell, row in
                cell.textField.textAlignment = .Left
            }

        +++ Section("Bio")

            <<< TextAreaRow() {
                $0.placeholder = "Write something about you"
            }
    }
}

I'm not sure what is going on. As a workaround try opening the assistance Editor then select FormViewController.swift in the assistant editor then you should be able to connect the tableView outlet from assistant editor with your table view on the main editor.

screen shot 2016-02-29 at 10 16 03 am

I ran into a similar problem. The reason was that XCode/InterfaceBuilder was getting confused by extensions on my view controller that declared additional protocols which IB interpreted as the view controller not inheriting from UIViewController. BTW - you may want to take this discussion to StackOverflow.

Thanks guys for the response. @mtnbarreto I used Carthage to install and I can't connect an IBOutlet to the compiled Eureka framework.

@rlaferla I didn't add any additional protocols in this case. But you're right this seems like an Xcode problem and perhaps not related to Eureka. It's the first time I've encountered this and thoughts it's a Eureka thing.

Can you temporarily remove FormViewControllerProtocol and then go back into IB? Your screenshot above shows that you had an additional protocol directly on the view controller but your code example in the comment above that one doesn't have it.

@rlaferla that screenshot above with the FormViewControllerProtocol is not mine. That's @mtnbarreto's
I have tested this on different computers and still same problem.
Will try to build a test project to share.

Problem seems related to linked Eureka.framework when using Carthage. Must be an Xcode swift framework linking bug.

Moving on... I've copied source straight into the project and all works. Good enough.

Reopening here because had same issue again when installing using Carthage.
Perhaps someone else can figure out why this is happening.

Storyboard doesn't seem to recognise IBOutlets inside Eureka.framework, nor the FormController.

I have created this simple example to showcase the problem:
https://www.dropbox.com/s/4wlyi6a2e6k3fv9/Eureka-SampleApp.zip?dl=0

Xcode: 7.2.1

Downloading Xcode 7.3 beta5 to try and report back.

@bachirelkhoury it seems that have nothing to do with Eureka neither carthage. Carthage/Carthage#763
So i will close the issue for now.

As a workaround install Eureka manually as embedded framework or using cocoapods.

This hackaround worked for me: open the assistant editor to show both the storyboard and the file containing your subclass of FormViewController. Paste the line "@IBOutlet public var tableView: UITableView?" into your subclass - it won't compile, but for me it made the little circle, which I could then drag onto the table view in the other pane. Then, delete that line; the IBOutlet link will persist.