Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TableView IBOutlet not showing in Storyboard #295

Closed
bachirelkhoury opened this issue Feb 28, 2016 · 9 comments
Closed

TableView IBOutlet not showing in Storyboard #295

bachirelkhoury opened this issue Feb 28, 2016 · 9 comments

Comments

@bachirelkhoury
Copy link

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"
            }
    }
}
@mtnbarreto
Copy link
Member

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

@rlaferla
Copy link
Contributor

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.

@bachirelkhoury
Copy link
Author

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.

@rlaferla
Copy link
Contributor

rlaferla commented Mar 1, 2016

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.

@bachirelkhoury
Copy link
Author

@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.

@bachirelkhoury
Copy link
Author

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.

@bachirelkhoury
Copy link
Author

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.

@mtnbarreto
Copy link
Member

@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.

@colinator
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants