UA-17470720-3

Jump to content


Photo
- - - - -

objectForSection Not Firing Swift 2.0 STV 5.1 Beta


  • Please log in to reply
1 reply to this topic

#1 wizgod

wizgod

    I'm what you guys call a User

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 575 posts
  • LocationThe Grid
Reputation: 149
Popular

Posted 05 September 2015 - 12:08 AM

Greetings Programs!
 

I'm using a class definition and it's added to the tableviewcontroller in the storyboard along with an SCArrayOfObjectsSection; basically the same as the TasksApp sample app.

 

In awakeFromNib, I am retrieving the forms from the web service which sends a notification when they have been retrieved:

 

The data is returned no problems but when I refresh the tableViewModel, the objectForASection isn't firing. In fact it doesn't fire at all, not even on load.

 

func retrievedForms(notification: NSNotification) {
	
	SVProgressHUD.dismiss()
	
	if notification.object == nil {
		return
	}
	
	let result = notification.object as! NSMutableDictionary
	
	forms = (result.objectForKey("GetActiveFormsResult") as! NSArray).mutableCopy() as! NSMutableArray
	
	tableViewModel.reloadBoundValues()
	tableView.reloadData()
}

override func objectForSection(objectSection: SCObjectSection!, atIndex index: UInt) -> NSObject! {
	return forms;
}

 

Suggestions as to what I am doing wrong? I compared my tableviewcontroller with the one in the TasksApp and didn't find anything out of the ordinary.

 

Thanks!

 

Wg


P.S. I love Swift... talk Swift.. Never too old school to learn yet another programming language. LOL! ;-)


#2 wizgod

wizgod

    I'm what you guys call a User

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 575 posts
  • LocationThe Grid
Reputation: 149
Popular

Posted 05 September 2015 - 01:33 PM

Stupid, stupid, stupid, stupid... wrong signature:  objectsForSection not objectForSection

 

I took the first one that popped up in autocomplete without giving it a second thought and seeing an "s" where there wasn't one... :wacko:

 

override func objectsForSection(objectsSection: SCArrayOfObjectsSection!, atIndex index: UInt) -> NSMutableArray! {
    return forms;
}

 

Wg


Edited by wizgod, 05 September 2015 - 02:08 PM.

P.S. I love Swift... talk Swift.. Never too old school to learn yet another programming language. LOL! ;-)





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users