AppMetric 1.9

AppMetric 1.9

Обновил AppMetric для macOS - клиент для сервиса AppMetrica от Яндекса.

  • Исправлена ошибка, когда при выборе сегодняшней даты она не обновлялась при смене дня.
  • Добавлено форматирование цифр показателей (в зависимости от языка и региона в системе).
  • Небольшие исправления.


comment comments

Creating a DMG File from the Terminal

Creating a DMG file from Terminal

Have you ever needed to package your application for distribution on macOS? The solution is simpler than you might think, and it's right at your fingertips in the Terminal. I recently stumbled upon a handy bash function that streamlines the creation of a DMG (Disk Image) file. Here's how to set it up:

Step 1: Edit Your Profile

nano ~/.zprofile

Step 2: Add the Bash Function

Next, insert the following function into your .zprofile. This script utilizes the hdiutil command, which is built into macOS, to create an HFS+ filesystem within a DMG file.

    hdiutil create -fs HFS+ -srcfolder "$1" -volname "$2" "$2.dmg"

Step 3: Save and Source Your Profile

After adding the code, save the changes and exit `nano`. To make the function available immediately without restarting your terminal, source your profile:

source ~/.zprofile

Step 4: Use the Function

Now, you can easily create a DMG file for any folder or application. For example, to create a DMG for the '', simply run:

dmg ModulbankInformer

This command will generate a ModulbankInformer.dmg file with the contents of the directory.

And there you have it - a quick and efficient way to create DMG files directly from your Terminal!

comment comments

Swift CouchDB client 1.5.0

Swift CouchDB client 1.5.0

And here we go, one more new version of the CouchDB client library. After the recent post about 1.4.0 the Swift on Server released a new version of async-http-client that has a new implementation of the client singleton. Now it's HTTPClient.shared, so I've updated the CouchDB library to adopt that. That also requires not to call httpClient.syncShutdown() if the singleton is used. Also they've bumped the minimum Swift version to 5.8 (I did the same in 1.4.0 for the CouchDB client library). So keeping the library up to date.


  • Bumped async-http-client minimum version to the new 1.21.0. If you can't use it in your project you can stay on 1.4.0.
  • The library will use HTTPClient.shared (new in async-http-client 1.21.0) internally for requests if no EventLoopGroup is provided.
  • No more internal calls for httpClient.syncShutdown() in case of HTTPClient.shared usage.

CouchDB Client on GitHub | Documentation with examples and tutorials.

comment comments

Swift CouchDB client 1.4.0

Swift CouchDB client

A new CouchDB Client version has been released:

  • The library migrated from HTTPClient.Response to HTTPClientResponse which is similar to HTTPClient.Response, but used for the Swift Concurrency API. Also it migrated from HTTPClient.Body to HTTPClientRequest.Body. These changes affect get and find methods. Old methods are marked as deprecated, check the docs for the updated methods.
  • Minimum Swift version is 5.8 now.
  • CouchDBRepresentable protocol is now marked as Codable.
  • Added a new RowsResponse data model that accepts a generic CouchDBRepresentable type which makes it easier to get rows from a database. Example:
    let decodeResponse = try JSONDecoder().decode(RowsResponse<MyApp>.self, from: data)
  • Small improvements in the documentation and tutorials.

CouchDB Client on GitHub | Documentation with examples and tutorials.

comment comments

A middleware for Vapor 4 routing to trim a slash in url path

It’s a common thing for a website or a backend to allow urls like and mySite.Com/webpage/ for the same page. These pages are different urls for a search engine so if you want to avoid duplicates you can add a simple middleware to trim the ending slash and redirect a user.

Here’s an example code for such middleware class for Vapor 4:

final class TrimSlashInPathMiddleware: Middleware {
    func respond(to request: Request, chainingTo next: Responder) -> EventLoopFuture<Response> {
        if request.url.path.count > 1, request.url.path.hasSuffix("/") {
            let newPath = String(request.url.path.trimmingSuffix(while: { $0 == "/" }))
            let response = request.redirect(to: newPath, redirectType: .permanent)
            return request.eventLoop.makeSucceededFuture(response)
        return next.respond(to: request)

Just add it to configure.swift file:

import Vapor

public func configure(_ app: Application) throws {

    app.http.server.configuration.port = 8081

    try routes(app)

Works with Vapor 4.92.5.

comment comments

Модульбанк информер 1.3

Модульбанк информер 1.3

Выпустил небольшое обновление для Модульбанк инфомера. Обновил иконку в статусбаре (тепер узнаваемая), и добавил чекбокс для скрытия счетов с нулевым балансом. Ну и немного рефакторинга.

Исходный код на GitHub:
Скачать можно тут:

comment comments

How to get selected text inside of TextEditor in SwiftUI on macOS

How to get selected text inside of TextEditor in SwiftUI on macOS

TextEditor in SwiftUI still doesn’t have any API to get user selection. But since it’s using NSTextView internally we can subscribe to its notifications.

Here’s an example of getting a substring from user selection:

Читать далее...

comment comments
local_offer swiftui macos