Creating a collage by combining an array of images (macOS & iOS)

In NewsWave, when you are in the “Add Feed” view you have the option to search the RSS repository, add a RSS URL or choose from ‘recommended feeds’.  Recommended feeds may change over time so, instead of using static images, NewsWave looks at the feeds from each recommended category and creates a collage to represent …

Using DispatchSemaphore to control async execution

I’ve been debugging the upcoming OPML Import functionality of NewsWave and this bug was driving me nuts:  in some cases and for no apparent reason URLSessions would fail without a callback.  At first the bug seemed random, but after a bit of testing I realized the more feeds I tried to import, the more likely the bug …

Opening links in Safari / Embedded Safari – iOS

In iOS you can either do it with a push: let safariVC = SFSafariViewController(url: URL(string: “www.google.com”)!, configuration: .init())   present(safariVC, animated: true, completion: nil)   or directly in the Safari app: UIApplication.shared.open(URL(string:“www.google.com”)!, options: [:]) { (_) in }   Very practical,    Marc

Reloading/inserting Dynamic Height cells and keeping Scroll position

For an upcoming app I had to insert Dynamic Height cells while keeping the tableView offset -scrolling position- constant. This would typically be a trivial issue, but given that when using Dynamic Height cells nor the contentSize nor the offset can be trusted it’s a bit more tricky than it seems… What I was trying …

Dealing with UIGraphics ImageContext ‘Memory Leaks’

Here’s the code to change the image size of an image in iOS so that then it can be saved with smaller footprint: let rect = CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height)          // Actually do the resizing to the rect using the ImageContext stuff UIGraphicsBeginImageContextWithOptions(newSize, false, 1.0) image.draw(in: rect) …

Pre-Scrolling a Table to a specific cell at load

Although that’s something that appears fairly easy, the truth -for me at least-, is that scrolling a UITableView to a specific cell every time you load it may prove tricky.  In the app I’m working on I implement it in the following way: every time a view appeared I assess if the top visible row …