UA-17470720-3

Jump to content


Photo
- - - - -

Can one tableview with a list open another linked tableview with a list in STV?

models sections view-controllers

  • Please log in to reply
28 replies to this topic

#21 wizgod

wizgod

    I'm what you guys call a User

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

Posted 11 January 2016 - 04:54 PM

So here is another version using a separate view controller in the storyboard instead of messing around with the detail view as in the previous version.

 

It instantiates the Activity view controller from the storyboard so STV is generating everything from the definitions and we don't have to add anything in code like we did when manually creating the SCArrayOfObjectsSection.

 

Using this method will cut down a lot of the code from the original version and save you from the headache of the hacked up detail view in the previous version.

 

Wg

 

Attached Files


Edited by wizgod, 21 January 2016 - 09:37 AM.

  • Morten Jacobsen likes this

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


#22 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 12 January 2016 - 05:00 AM

Apologies to everyone on the downtime. Full details here: http://sensiblecocoa...-moved-servers/



#23 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 12 January 2016 - 05:03 AM

Just noticed strange missing attachments, so working on it.



#24 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 12 January 2016 - 05:32 AM

Attachment issues seem to be fixed now.


  • Dave Guerin likes this

#25 wizgod

wizgod

    I'm what you guys call a User

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

Posted 21 January 2016 - 09:42 AM

Um, sorry, made a mistake...

 

In the MasterViewController, you need to set the bound object in the willAppear action of the ActivityViewController and not on instantiating it like I had it set.

 

I've updated the archive but you just need to replace the block with:

 

// Set the bound object to the activity for the account in the cell.
viewController.actions.willAppear = {
    (viewController) in
    
    if let section = viewController.tableViewModel.sectionAtIndex(0) as? SCArrayOfItemsSection
    {
        section.dataStore.bindStoreToPropertyName("activity", forObject: cell.boundObject, withDefinition: accountDef)
    }
}

 

Wg


  • Morten Jacobsen likes this

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


#26 Morten Jacobsen

Morten Jacobsen

    Experienced Member

  • STV 5.0 Pro
  • PipPipPipPip
  • 52 posts
Reputation: 10
Good

Posted 21 January 2016 - 03:47 PM

I had problems with the former version. All activities appeared for every account. I tried to fix it but wasn't able. Imagine my joy when your last version appeared today!

 

With your new actions.willAppear activities are only present for its account, i.e., it's correct.

 

Somehow actions.willDismiss from the first version was absent, so new activities amounts weren't added to the account balance. I added willDismiss back, and as of now, all works like a charm :)

 

It costs me a lot of thought to understand what's happening, but as of today, your code makes a lot more sense. And it gives me hope that I actually can achieve my accounting app using STV.

 

Thanks a lot for your involvement! I'm very grateful!

 

Morten - a Norwegian health refugee is living in Villajoyosa, Spain on the Mediterranean shore.



#27 ozie

ozie

    ¯\_(ツ)_/¯

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 526 posts
  • LocationAustralia
Reputation: 169
Popular

Posted 21 January 2016 - 04:23 PM

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

 

really :P


  • Dave Guerin likes this

P.S. I hate Swift.. don't talk Swift.. Too old school to learn yet another programming language.


#28 wizgod

wizgod

    I'm what you guys call a User

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

Posted 23 January 2016 - 10:09 PM

really :P

 

Hahaha! I was wondering when you'd finally see that :D !


  • Dave Guerin and Morten Jacobsen like this

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


#29 Morten Jacobsen

Morten Jacobsen

    Experienced Member

  • STV 5.0 Pro
  • PipPipPipPip
  • 52 posts
Reputation: 10
Good

Posted 24 January 2016 - 12:37 AM

Hahaha! I was wondering when you'd finally see that :D !

I did see it, but as you know, humor is both locally and nationally dependent. And making it worse, I'm quite stupid in understanding jokes, hints and so on - even in Norwegian!

 

I was wondering what you meant with the change of tagline:  "I love Swift... talk Swift.. Never too old school to learn yet another programming language. LOL! ;-). "

Not knowing if it was ironic or not. It didn't matter. You made me understand this esoteric STV-stuff, and I was just grateful. And would liked whatever you wrote.  :)

 

I'm thinking about writing a blog post about List->List in STV. That should be a pattern interesting many. But you may be way better suited to explain your code than me. Do you want to make a blog post?

 

 

If not, will you revise mine?







Also tagged with one or more of these keywords: models, sections, view-controllers

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users