September 3, 2017

Assigning Swift closure into JSValue object

The closure code to be passed into the JSValue object must have @convention(block) attribute is required. Here is the sample code:.

let closure: @convention(block) (_ value: JSValue) -> JSValue = {
  (_ value: JSValue) -> JSValue in
  /* contents of closure */
... = JSValue(object: closure, in: ctxt)) /* Allocate JSValue */

There is following description in Apples's document about JSValue. But I didn't noticed.

Objective-C blocks (or Swift closures with the @convention(block) attribute) become JavaScript Function objects, with parameter and return types converted using the same rules as values. Converting a JavaScript function backed by a native block or method returns that block or method; all other JavaScript functions convert as empty dictionaries.

The @convention(block) directive is used to generate the closure code which has compatibility with the C object.

August 18, 2017

Programming Language: Forth

Here is link list about the Forth language:

  1. Programming Language: Forth: ANS Forth published by American National Standard for Information Systems
  2. Forth関連の情報サイトのまとめ(Japanese)

[Xcode] Unsolved warning messages

These warning messages can not be suppressed yet. The Xcode version is 8.3.3.
  • NSOpenPanel (for macOS):

    When I use NSOpenPanel in my swift application, following message are displayed in the Xcode log window.

    warning: <NSRemoteView: 0x6100001205a0> determined it was necessary to configure <NSVBOpenPanel: 0x100f138e0> to support remote view vibrancy
  • UITextView (for iOS):

    [MC] Reading from private effective user settings.

August 17, 2017

Generalized Unix Command Line Parameter Notation

If the notation of command line parameter for Unix command is defined, it will be used for following situations:

  1. The notation is used to communicate between GUI shell and unix command.
  2. The notation can be used to implement new unix command to control other commands.

This project defines "Canary Command Line Notation" for the notation of command line parameter for unix commands. For more details, see Canary Command Line Notation.

Execute shell commands by Cocoa application

August 7, 2017

Suppress resizing window which contains NSStackView

If there are no constraint on the top level NSStackView, the size of window will be changed when the stack view is updated.
To avoid this resize, give the fixed size to the top level stack view.

July 25, 2017

NSOpenPanel crashes

Do not remember Sandbox setting when you use NSOpenPanel in the application. If it is not set, the NSOpenPanel causes exception.

July 23, 2017

Posted documents on the other sites

Released documents

Programming Language

  • Amber: The programming language for user interface design


Design Pattern

June 29, 2017

Swift class to implement variables at JavaScriptCore

Here is a table to know which class is used to implement variable on JavaScriptCore.


  1. The boolean value will be kept as NSNumber<Int> when it is a member of array and dictionary.
Object in JavaScript Type hierarchy to present by Swift
true JSValue.Bool
123 JSValue.NSNumber<Double>
1.23 JSValue.NSNumber<Double>
["hello", "world"] JSValue.Array.String
[true, false] JSValue.Array.NSNumber<Int>
[a:12] JSValue.Dictionary[String: NSNumber<Double>]
[a:true] JSValue.Dictionary[String: NSNumber<Int>]

May 27, 2017

Unix Tool Tips


rsync -auvE --delete source-dir destination-dir

Sync the directories. The destination directory will have same contents of source directory.

April 2, 2017

Released Software


These frameworks are targeting macOS and iOS: