As we start 2020 I wanted to take a moment to look back into 2019. The launch of NewsWave this past May was the indisputable highlight. Releasing a new app after months of work is always a nerve wracking experience. Fortunately the app was very positively received, since launch the app has been updated multiple times …
Category Archives: development
NSImage with Rounded Edges
Nothing like vacation to accelerate personal projects, very happy with how NewsWave for Mac is shaping up. No promises on when, but I’m planning to post more about its progress very soon. One of the items I worked on today is how icons and images will appear in the app, the intent is to show …
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 …
Continue reading “Creating a collage by combining an array of images (macOS & iOS)”
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 …
Continue reading “Using DispatchSemaphore to control async execution”
Create UIButton in code (swift)
Adding and customizing UIButtons in storyboard is extremely easy (and I would recommend doing it that way whenever possible), but what if you need to do it yourself in code? The process takes only couple of lines of code, but it can escalate quickly if you add multiple buttons. To keep code clean I’ve created …
Animating UIView by changing constraints
That’s one of the most fun and easiest animations you can do. First, let’s make sure we know what constraint to change: you’ll have to make sure you either have the constraint as an @IBOutlet or -if you’ve added in code- make sure you add an identifier to it. Then you’ll trigger a constant change …
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 …
Continue reading “Reloading/inserting Dynamic Height cells and keeping Scroll position”
Measuring function execution time
This is a very quick one. For an app I’m working on I wanted to measure how long it took a given function to complete. I typically don’t do this, as most functions are very fast, but this one involved a server fetch and some background processing. Anyhow, I’m getting distracted, here it is -easy …
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) …
Continue reading “Dealing with UIGraphics ImageContext ‘Memory Leaks’”