0

I'm trying to convert a simple UITableViewController to PFQueryTableViewController in Swift. So far I know I have to initialise my class like that: (source)

class TestTableViewController: PFQueryTableViewController {

required init(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
}

override init(className aClassName: String!) {
    super.init(className: aClassName)

    self.parseClassName = aClassName
    self.textKey = "YOUR_PARSE_COLOMN_YOU_WANT_TO_SHOW"
    self.pullToRefreshEnabled = true
    self.paginationEnabled = false
}
}

I have two problems:

  • somehow I cannot import PFQueryTableViewController
  • I would like to use a cloud function for feeding my table instead of a Query object.

Any idea?

1 Answer 1

2

In bridging header for Swift you need to import "ParseUI.h" as below. Then you need to initialize the class name in 'init:coder'

#import '<ParseUI/ParseUI.h>'

Init of PFQueryTableViewController class object

override init!(style: UITableViewStyle, className: String!) {
    super.init(style: style, className: className)
}


required init(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)

    self.parseClassName = "MyClass"
    self.pullToRefreshEnabled = true
    self.paginationEnabled = true
    self.objectsPerPage = 50
}

```

Regarding the second question, if you are about to use the Parse Cloud Function so there's no need to use the PFQueryTableViewController class. Just using the normal UITableViewController and run your cloud function upon controller initialization

Sign up to request clarification or add additional context in comments.

2 Comments

thanks for you answer. About the second point, I would be interested in the paging functionality of the PFQueryTableViewController so I was wondering if there is anyway to pass this class a PFCloud function instead of a PFQuery
Thanks @Wajatimur - That extra import caught me out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.