UA-17470720-3

Jump to content


Photo
- - - - -

STV Swift Package


  • Please log in to reply
9 replies to this topic

#1 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 545 posts
  • LocationIreland
Reputation: 137
Popular

Posted 26 October 2019 - 02:46 AM

Hi all,
 
Long time no see!! I hope everyone is happy, in good health, and keeping busy.
 
I'm not sure about everyone else, but I still use STV in my apps. There were quite a few issues with iOS 13, STV was "attempting to access the table view's visibleCells while they were in the process of being updated, which is not allowed" which was causing an assert in the first few betas. Release versions of iSO 13 no longer assert, just loads of warnings in the console.
 
I've updated the STV code to no longer cause these assets/warnings, and fixed quite a few other warnings as well, and eventually got STV to work as a Swift Package. Hurrah! STV might be slightly less efficient  as a result of some of my changes, but it works for me!
 
If anyone else is interested I can make my currently private STV GitHub repository public for everyone to use. It's not a fork of Wizgods repository, more a total rebuild from scratch. Here's my full CHANGELOG:
 
 
* No longer a framework, now a Swift Package.
* Added Ozies fix for disappearing cells in iOS 11. Thanks Ozie!
* Added lots of self-> to avoid an Xcode warning: "Block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behaviour".
* Remarked out the -splitViewController:shouldHideViewController:inOrientation: method as it's now deprecated.
* The -live method of SCTableViewModel was causing an assert in iOS 13: "Attempted to access the table view's visibleCells while they were in the process of being updated, which is not allowed". So STV is no longer trying to count the visibleCells there, which might make it slightly less efficient, but there's no assert!
* The -cellAtIndexPath: method of SCTableViewModel was also causing an assert in iOS 13: "Attempted to call -cellForRowAtIndexPath: on the table view while it was in the process of updating its visible cells, which is not allowed". This was introduced by the change in -live. So STV is no longer calling -cellForRowAtIndexPath here, which again is going to make it less efficient, but now there's no assert.
* The -tableView:shouldIndentWhileEditingRowAtIndexPath: method of  SCTableViewModel was also causing an assert in iOS 13: "Attempted to call -cellForRowAtIndexPath: on the table view while it was in the process of updating its visible cells, which is not allowed." A bit of a kludge, but the method now just returns the default value, YES, here.
* Remarked out a deprecated method -splitViewController:shouldHideViewController:inOrientation: in both SCViewController and SCTableViewController.
* Fixed lots of "This block declaration is not a prototype" warnings from Xcode 11 with the suggested fix of adding void.
* Removed all the Interface Builder/Storyboard stuff, sorry Tarek.
* Removed the examples.
* Removed the framework build scripts as they are no longer required.
* Removed the install and uninstall scripts as they are no longer required.
* Removed the Xcode templates.
* Edited the inline documentation to fix all Xcode warnings.
* Added STVCoreData classes to the main package. STViCloud, STVParse, and STVWebServices are not part of this package.
* Added license files in TXT and PLIST format. The PLIST can be used in a Settings bundle.
 
 
The license is as follows:
 
Sensible TableView
Copyright © 2018 SensibleCocoa
Copyright © 2018 Wizgod
Copyright © 2019 dgApps
 
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
 
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
Open sourced with the permission of Sensible Cocoa/Tarek Sakr on 12 April 2018.
 
 
I also changed the copyright in each file to just "Copyright 2011-2015 Sensible Cocoa. All rights reserved."
 
And added my own copyright to just the files I'd made changes in.
 
 
I'm working on getting the documentation to up to date, and want to change all the UIColor to iOS 13 system colours so that Dark Mode is supported, and change all UIFont to UIFontTextStyles so that Dynamic Type is supported.
 
 
 
 
 
 
All comments welcome!
 
Cheers, 
 
Dave 
 
 

  • ozie likes this
Cheers,

Dave

www.dgapps.ie

#2 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 545 posts
  • LocationIreland
Reputation: 137
Popular

Posted 12 November 2019 - 07:53 AM

Hello again everyone,

 

I made my STV Swift Package public if any one is interested:

 

https://github.com/daveguerin/STV

 

 

As well as the changes I listed above, the following has also changed:

 

 

Now using iOS 13 labelColor with a fallback for earlier iOS.

Now using UIFontTextStyleBody as the main font.
Added two new cellActions: leadingSwipeActions and trailingSwipeActions. iOS 11 and up only.
All UIPopoverController are now clang diagnostic ignored "-Wdeprecated-declarations"

 

 

The documentation has also been update slightly:

 

https://daveguerin.github.io/STV/

 

and there's a new Docset Feed:

 

https://daveguerin.g...docsets/STV.xml

 

 

All comments welcome!

 

 


  • halldorg likes this
Cheers,

Dave

www.dgapps.ie

#3 Gerald K.

Gerald K.

    Sr. Member

  • STV 5.0 Std
  • PipPipPip
  • 43 posts
Reputation: 6
Good

Posted 14 January 2020 - 12:05 AM

Hi Dave!

 

I recently had to update one of my older apps (that used STV) and all hell broke lose with iOS 13.

 

I really appreciate the work you put into this and will check it out during the coming weeks, will report back.

 

All the best,

Gerald


  • Dave Guerin likes this

#4 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 545 posts
  • LocationIreland
Reputation: 137
Popular

Posted 14 January 2020 - 04:57 AM

Hi Gerald,

 

I hope it works for you, let me know if it doesn't and I'll see what I can do.

 

Documentation has moved to here: https://daveguerin.g...VDocumentation/

 

Docset feed has moved to here: https://daveguerin.g...docsets/STV.xml


  • designwerks likes this
Cheers,

Dave

www.dgapps.ie

#5 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 141 posts
  • LocationKingsville, Ontario, Canada
Reputation: 23
Excellent

Posted 24 April 2020 - 06:37 PM

Hi Dave,

 

I am about to try my first project using the Swift Version... I have used STV in Objective-C very successfully in a number of my apps, but want to try one in Swift Language.

 

I have followed all your steps to load and all is working well. Thank you for very clear instructions.

 

One question - Is there a simple example project in Swift, like there was in Objective-C, so I can review necessary code to insert...

 

Thanks,

 

John



#6 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 545 posts
  • LocationIreland
Reputation: 137
Popular

Posted 25 April 2020 - 02:14 AM

Hi John,
 
 
I'm glad you found it easy following my instructions. You never know if you've missed something until someone else gives it a go!
 
Example project are on my TODO list. I'm not at all conversant with Swift unfortunately, so my examples would probably be the Objective C examples updated to use the Swift Package version of STV.
 
@wizgod is probably the man for Swift examples, or if you get it working maybe you could convert some of the current examples to Swift.

 

I'm thinking maybe examples should be in a separate STVExamples repository.

 

Some of my changes to avoid crashes/warnings in iOS 13 I need to look at again as I think some of them aren't very efficient when it comes to cell reuse.

 

Let us know how you get on with the STV SPM and Swift!

 

 

Cheers, 

 

Dave 


Cheers,

Dave

www.dgapps.ie

#7 Gerald K.

Gerald K.

    Sr. Member

  • STV 5.0 Std
  • PipPipPip
  • 43 posts
Reputation: 6
Good

Posted 14 May 2020 - 01:53 AM

Hi Dave!

 

As promised, my report on how the upgrade to your version went. I actually planned to do this during summer, but a bug forced my hand and I had to do it today.

 

So far it only took me about an hour, and preliminary testing suggests that all went well and without hiccup.

 

About the only thing I had to adjust were the modalPresentationStyles on my PopOvers, which now need to be set to fullScreen if you don't want Apple's swipe down to close functionality.

 

I'm chuffed with the results and can't thank you enough for your work!

 

All the best,

Gerald



#8 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 545 posts
  • LocationIreland
Reputation: 137
Popular

Posted 18 May 2020 - 08:48 AM

Hi Gerald,

 

Thanks for letting me know how it went. I glad you got it all working without too much trouble.

 

I think the modalPresentationStyles are an iOS thing and not an STV but if that's all you had to change then great!

 

I should return to have a better look at the STV SCTableViewModel methods -live,  -cellAtIndexPath:, and -tableView:shouldIndentWhileEditingRowAtIndexPath: at some point. My fix for the iOS 13 error/warning has made STV less efficient, I think STV is now creating some cells repeatedly for the same index. They are all dealloc when they are done with, but a cell at an index should only be created the once. I'll take a look sometime soon (ish)!

 

 

Cheers, 

 

Dave 


Cheers,

Dave

www.dgapps.ie

#9 Gerald K.

Gerald K.

    Sr. Member

  • STV 5.0 Std
  • PipPipPip
  • 43 posts
Reputation: 6
Good

Posted 27 May 2020 - 04:49 AM

Hi Dave,
 
i just noticed something that, I think, hasn't happened before. When I select some rows they behave as if the background-color of the labels is fixed and cannot change to the default selected-color. Have you seen anything like this before?
 
I checked that If I change the background color of the labels in willDisplay blocks I can set them to [UIColor clearColor] for example to fix it for some labels, but changing them all would be a pain. Any idea why this could happen?
 
Thanks,
Gerald

 

 



#10 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 545 posts
  • LocationIreland
Reputation: 137
Popular

Posted 29 May 2020 - 12:10 AM

Hi Gerald,

 

I _think_ this is an iOS 13 thing, previously the default background colour of a label in a cell was white, as that was the default background colour of a cell.

 

To accommodate Dark Mode I think the default has now change to clear.

 

I _think_.

 

Cheers, 

 

Dave  


Edited by Dave Guerin, 29 May 2020 - 12:11 AM.

Cheers,

Dave

www.dgapps.ie




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users