Skip to content

Instantly share code, notes, and snippets.

View ianpartridge's full-sized avatar

Ian Partridge ianpartridge

  • IBM
  • UK
View GitHub Profile

Here's a Hindi word: “नमस्ते”.

Here are its Unicode Scalar Values:

['न', 'म', 'स', '्', 'त', 'े']

(the fourth and sixth values are diacritics)

@ianpartridge
ianpartridge / wwdc2019.md
Last active June 6, 2019 09:41
WWDC 2019 recommended talks

Introductions

What's New in Xcode 11

Start the week with a tour of new features in Xcode 11, designed to help you get from idea to product faster than ever. Discover new ways to edit and organize your source code, new capabilities for designing and previewing user interfaces, and great improvements for debugging and testing. Get an overview for sessions covering developer tools this year.

https://developer.apple.com/videos/play/wwdc2019/401/

What's New in Swift

@ianpartridge
ianpartridge / foundation.md
Created May 1, 2019 09:37
The effect of linking Foundation on Linux

Without Foundation:

# swift package init --type executable && swift run
Creating executable package: bare
Creating Package.swift
Creating README.md
Creating .gitignore
Creating Sources/
Creating Sources/bare/main.swift
// swift-tools-version:4.2
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "MyServer",
dependencies: [
.package(url: "https://github.com/IBM-Swift/Kitura.git", .upToNextMinor(from: "2.6.1")),
.package(url: "https://github.com/IBM-Swift/Kitura-CredentialsHTTP.git", .upToNextMinor(from: "2.1.1")),
import Foundation
import PlaygroundSupport
struct Film: Decodable
{
let title: String
}
struct Films: Decodable
{
@ianpartridge
ianpartridge / swift-linux-testing.md
Created August 9, 2017 13:00
Swift Packages: Linux Compatibility Testing

Swift Packages: Linux Compatibility Testing

As the Swift on Linux and Swift Package Manager ecosystems mature, many authors of Swift packages want to enable their packages on Linux as well as Apple platforms. The growth of Server-Side Swift makes Linux an important target for many packages.

The first step is to run a package's unit tests on Linux, to verify it behaves as expected.

Enabling unit tests on Linux

Because Swift on Linux does not use the Objective-C runtime, the dynamic features that the XCTest unit testing framework uses to automatically discover testcases are not available.

@ianpartridge
ianpartridge / foundation_history.sh
Created August 2, 2017 11:26
Show the number of NSUnimplemented() methods in swift-corelibs-foundation over time
#!/bin/bash
for commit in $(git rev-list --no-merges master)
do
DATE=$(git show -s --date=iso-local --format=%cd $commit)
COUNT=$(git grep NSUnimplemented $commit | wc -l)
echo "$commit, $DATE, $COUNT"
done
@ianpartridge
ianpartridge / foundation_on_linux.md
Last active August 8, 2017 13:20
Foundation on Linux
layout title
page
Foundation on Linux

Foundation

As a core library which underpins many Swift packages, the Foundation project is a key part of the overall swift.org ecosystem. Foundation provides a baseline of fundamental types and functionality which is useful to all applications and can be implemented on a broad range of platforms and operating systems.

Since Swift became open source in 2015 the community has worked together to improve the implementation of Foundation on Linux and the project has progessed significantly.

// You have an enumeration:
enum Enum {
case foo(Int)
case bar(String)
case qux(Int)
}
// And you have an array of them:
@ianpartridge
ianpartridge / AsyncOperation.swift
Last active January 23, 2017 11:21
Asynchronous Operation in Swift 3
import Foundation
import Dispatch
class AsyncOperation: Foundation.Operation {
private let queue = DispatchQueue(label: "async.operation.queue")
private var _executing = false
private var _finished = false