Skip to main content

Posts

Integrating SwiftUI into Existing AppKit Cocoa Projects: A Step-by-Step Guide

Recent posts

Getting Started with Gulp.js: A Beginner's Guide to Boost Your Web Development Efficiency

Gulp.js Tutorial: Getting Started Discover why this step-by-step Gulp.js tutorial is your best resource for learning task automation in web development. Unlike many other tutorials, this guide is tailored for beginners, providing clear explanations, practical examples, and a comprehensive overview to help you quickly and effectively integrate Gulp.js into your projects. Don't waste time sifting through countless tutorials—start here and streamline your workflow today!  Introduction Automating repetitive tasks in web development can significantly boost productivity and streamline your workflow. Gulp.js is a powerful toolkit designed to help developers automate tasks such as minifying files, compiling Sass, optimizing images, and more. Whether you're a seasoned developer or just starting, this comprehensive tutorial will guide you through the basics of Gulp.js, helping you integrate it into your projects efficiently. Let's dive in and discover h

How to Use OUIEditableFrame with the OmniGroup Framework

TLDR: This blog post provides a detailed tutorial on how to implement OmniGroup’s OUIEditableFrame in an iOS project to render text with proper kerning, which cannot be achieved with standard UIKit controls due to a bug. The guide walks through creating and configuring an Xcode workspace, cloning the OmniGroup project from GitHub, adding necessary frameworks and dependencies, and writing the required view controller code. Learn to implement OmniGroup's OUIEditableFrame for proper text kerning in iOS projects with this step-by-step Xcode tutorial. Table of Contents: Introduction Create and Configure Xcode Workspace Clone the OmniGroup Project from GitHub Add the FixStringsFile Project Add OmniBase Add the Rest of the Frameworks Write View Controller Code Making It Work in iOS 5 Get Rid of the Static Analyzer Message If you need a UITextField that renders text with proper kerning you don’t have many of options. Writing al

How to Cache NSDateFormatter?

Instantiating NSDateFormatter objects is slow. Most well-written apps that use NSDateFormatter will make efforts to reduce the number unique instances created. Using a static property is sufficient for most cases, but what if you work on a large app where lots of NSDateFormatter objects are needed by a large number of classes. Wouldn’t it be nice if there was an NSCachedDateFormatter that keeps track of what it has instantiated and will return cached objects and only instantiate new ones when necessary? Wouldn’t it be nice if NSCachedDateFormatter was a singleton and could be used app-wide? Here's a sample class that can be used to fulfill this need.

Zooming Images with Text in an iOS Scroll View

You have an image containing text. As such, there’s lots of sharp edges. You want to put this image into a scroll view and allow the user to zoom in with a pinch gesture. This is very easy to implement in iOS. Technically, you don’t even need to write code. This can all be done in Interface Builder. However, the further the image is zoomed the blurrier it looks. Solution 1 Start with a fully zoomed of the image and scale it down when initially adding it to the scroll view. After all, it’s much easier to scale an image down and keep it looking good than it is to scale it up. So during the whole zoom operation the image being displayed is a scaled down version of the original. This would work great except that iOS doesn’t apply the right interpolation when scaling the original large down to fit into the initial smaller frame. You would think self.imageView.layer.minificationFilter = kCAFilterTrilinear; would do the trick but it doesn’t. I could be doi

The Python Code Handbook (free book with 40 code examples)

Introducing the Python Code Handbook from FreeCodeCamp that are worth your time: 1. This handbook will teach you Python for beginners through a series of helpful code examples. You'll learn basic data structures, loops, and if-then logic. It also includes plenty of project-oriented learning resources you can use to dive even deeper. (full handbook):  https://www.freecodecamp.org/news/python-code-examples-simple-python-program-example/ 2. freeCodeCamp just published this course to help you pass the Google Associate Cloud Engineer certification exam. If you want to work as a DevOps or a SysAdmin, this cert may be worth your time. You'll learn Cloud Engineering fundamentals, Virtual Private Cloud concepts, networking, Kubernetes, and High Availability Computing. (20 hour YouTube course):  https://www.freecodecamp.org/news/google-cloud-digital-leader-certification-study-course-pass-the-exam-with-this-free-20-hour-course/ 3. React Router 6 just came out a few months ago, and freeCod

Vertical Labels in iOS (using Objective-C)

View transformations are something you might wanna need to learn more about. While rethinking the iPad interface for his UTC Chart app, it occurred to mluton to use vertical labels. After a bit of research this is what he came up with. - (void)viewDidLoad { [super viewDidLoad]; NSString *string = @"Lorem Ipsum"; UIFont *font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]; UILabel *label = [[UILabel alloc] init]; label.font = font; label.text = string; CGSize size = [string sizeWithAttributes:@{NSFontAttributeName:font}]; label.frame = CGRectMake(40, 40, size.width, size.height); [label.layer setAnchorPoint:CGPointMake(0.0, 0.0)]; label.transform = CGAffineTransformMakeRotation((M_PI) / 2); [self.view addSubview:label]; } The frame and setAnchorPoint values can be modified to achieve desired positioning. He chose to bypass any potential autolayout/transform conflicts by creating the label progr