Khoa Pham
Khoa Pham

Ohayo

Swift Discovery

Discover all the tech

Featured

My year in review 2020

Issue #715

I remember this time last year in December 2019, I spent almost every single bit of my free time on Puma because I want a Swift friendly version of fastlane that suits my need and leverages Swift 5 features.

Here’s my review of my …

How to get properties of JSValue in JavascriptCore

Issue #179

let rough = context.objectForKeyedSubscript("myObject")
myObject.toDictionary()

How to run ffmpeg in macOS app

Issue #178

Install ffmpeg, which installs ffprobe

brew install ffmpeg

Find location of installed ffmpeg

which ffmpeg

Add all executables to project

Get error

unable to obtain file audio codec with ffprobe

Run in verbose mode

ffmpeg -v

Get

[debug] …

How to get path to resource in running macOS app

Issue #177

This is useful to refer to another executable in a running executable in Process

Bundle.main.path(forResource: "ffmpeg", ofType: "")!

How to run executable in macOS

Issue #176

Enable executable

chmod +x executable

Add executable file to target Use Process with correct launchPad

import Foundation

protocol TaskDelegate: class {
  func task(task: Task, didOutput string: String)
  func taskDidComplete(task: Task)
} …

How to print current directory using Process in macOS

Issue #175

let process = Process()
process.launchPath = "/bin/pwd"
process.arguments = []

Should be the same as FileManager.default.currentDirectoryPath

How to change NSTextField backgroundColor in NSPopover

Issue #174

Disable vibrancy mode of NSPopover

let popover = NSPopover()
popover.appearance = NSAppearance(named: NSAppearance.Name.aqua)

How to make scrollable vertical NSStackView

Issue #173

You might need to flip NSClipView

import AppKit
import Anchors
import Omnia

final class ScrollableStackView: NSView {
    final class FlippedClipView: NSClipView {
        override var isFlipped: Bool {
            return true
        } …

How to make view take up full width in vertical NSStackView

Issue #172

https://stackoverflow.com/questions/51644692/nsstackview-subviews-not-resizing-sub-stack-views/55220837#55220837

If you want child view inside vertical NSStackView to fill its parent width, then reduce contentCompressionResistancePriority …

How to load top level view from xib in macOS

Issue #171

var views: NSArray?
NSNib(nibNamed: NSNib.Name("ProfileView"), bundle: nil)?.instantiate(withOwner: nil, topLevelObjects: &views)
let profileView = views!.compactMap({ $0 as? ProfileView }).first!

How to fix MethodError - undefined method `real_path` with CocoaPods?

Issue #170

abc

I’m using cocoapods 1.6.0.beta.2 in a React Native apps and it has been working fine. The pods that I need is Firebase and FacebookSDK. Today after pod install, I got error

NoMethodError - undefined method `real_path' for …

Testimonial

Issue #169

https://medium.com/@kylpo/wow-i-learned-so-much-from-this-article-thank-you-595f29077633 …

Understanding weak and strong in Objective C

Issue #164

From my own blog post https://github.com/Fantageek/fantageek.github.io/blob/source/source/_posts/2014-06-27-understanding-weak-self-and-strong-self.markdown


Blocks are wonderful. To avoid retain cycle you often see the weakSelf - …

Interesting, how did you managed to plug GitHub issues into the dev.to platform

Issue #163

I’ve found your post https://dev.to/onmyway133/changing-electron-app-icon and fist thought there is some static site generator which uses GitHub’s issues as a datasource.

Am I right?

Trying IBM Watson

Issue #162

Request and Task

Issue #161

https://developer.apple.com/documentation/foundation/urlsession https://developer.apple.com/documentation/speech

Learning from Open Source Colocate test files

Issue #160

https://github.com/kickstarter/ios-oss/blob/master/Kickstarter-iOS/ViewModels/RootViewModel.swift …

Using CircleCI 2.0

Issue #158

We ’ve been using CircleCI for many of our open source projects. Since the end of last year 2017, version 2.0 began to come out, and we think it’s good time to try it now together with Swift 4.1 and Xcode 9.3

The problem with …

Jitter buffer in VoIP

Issue #157

This post was from long time ago when I did pjsip


A jitter buffer temporarily stores arriving packets in order to minimize delay variations. If packets arrive too late then they are discarded. A jitter buffer may be mis-configured and be …

Some Windows Phone 7 development tips

Issue #156

This post was from long time ago when I did Windows Phone 7


Welcome back, today I will start writing all stuff, all the secret I ’ve revealed when developing for Windows Phone 7.

  1. When setting UIElement’s Visibility to …

How to calculate packet size in VoIP

Issue #155

As you have probably observed in your studies, there is a determined method for calculating VoIP packet sizes. The packet size depends on many different variables, so there is no great answer for an “average” packet size …

Khoa Pham

Hello, I’m Khoa

I’m a thinker and storyteller with a passion for exploring the intersection of creativity and technology

🧑‍💻 I love crafting high quality and useful apps
🔥 I love open source. My GitHub open source has 2.3k followers with packages that are integrated by 45k+ apps and over 3.4m+ downloads on CocoaPods.
✍️ I write here on my blog and on Medium, which has over 2.7k+ followers with tons of articles and 90k+ monthly views.
🖥 Follow me for sharings about Swift, SwiftUI, iOS and macOS development.
Hei