Skip to Content
0
Aug 12, 2019 at 12:47 PM

How to use FUIFormTableViewController inside UIViewController?

143 Views Last edit Aug 12, 2019 at 01:05 PM 5 rev

I have UIViewController called createFormViewController.swift. Created UITableView inside createFormViewController. Tried by setting class reference for tableview FUIFormTableViewController and module SAPFiori in storyboard.

Its shows error unselector instance sent.

Here is my code:

import UIKit

import SAPOfflineOData

import SAPFoundation

import SAPFiori

import SAPCommon

import SAPOData

class NewViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

@IBOutlet weak var tableView: UITableView!

var person = Person.init(firstName: "Steve", lastName: "Nelson", dateOfBirth: Date.init(), title: 0, gender: 2)

override func viewDidLoad() {

super.viewDidLoad()

tableView.register(FUISimplePropertyFormCell.self,

forCellReuseIdentifier: FUISimplePropertyFormCell.reuseIdentifier)

tableView.register(FUIDatePickerFormCell.self,

forCellReuseIdentifier: FUIDatePickerFormCell.reuseIdentifier)

tableView.register(FUIListPickerFormCell.self,

forCellReuseIdentifier: FUIListPickerFormCell.reuseIdentifier)

tableView.register(FUISegmentedControlFormCell.self,

forCellReuseIdentifier: FUISegmentedControlFormCell.reuseIdentifier)

tableView.register(FUIAttachmentsFormCell.self,

forCellReuseIdentifier: FUIAttachmentsFormCell.reuseIdentifier)

}

func numberOfSections(in tableView: UITableView) -> Int {

// #warning Incomplete implementation, return the number of sections

return 1

}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

// #warning Incomplete implementation, return the number of rows

return 6

}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

let row = indexPath.row

switch row{

case 0:

//First Name

let cell = tableView.dequeueReusableCell(withIdentifier: FUISimplePropertyFormCell.reuseIdentifier, for: indexPath) as! FUISimplePropertyFormCell

return cell

case 1:

//Last Name

let cell = tableView.dequeueReusableCell(withIdentifier: FUISimplePropertyFormCell.reuseIdentifier, for: indexPath) as! FUISimplePropertyFormCell

return cell

case 2:

//Date of Birth

let cell = tableView.dequeueReusableCell(withIdentifier: FUIDatePickerFormCell.reuseIdentifier, for: indexPath)

as! FUIDatePickerFormCell

return cell

case 3:

//Title

let cell = tableView.dequeueReusableCell(withIdentifier: FUIListPickerFormCell.reuseIdentifier, for: indexPath)

as! FUIListPickerFormCell

return cell

case 4:

return cell

default:

//Attachment

//Date of Birth

let cell = tableView.dequeueReusableCell(withIdentifier: FUIDatePickerFormCell.reuseIdentifier, for: indexPath)

as! FUIDatePickerFormCell

return cell

}

}

}

How to use FUIFormTableViewController inside viewcontroller?