Skip to content

Instantly share code, notes, and snippets.

@alexito4 alexito4/lists.swift
Last active May 8, 2019

What would you like to do?
Swift script to convert Reminders export files (.ics) to lists.
#!/usr/bin/swift sh
import Foundation
guard let path = CommandLine.arguments.dropFirst().first else { exit(1) }
let content = try! String(contentsOfFile: path)
let lines = content
.split(separator: "\r\n")
let summaryPrefix = "SUMMARY:"
let extraPrefix = "X-APPLE-ACTIVITY;VALUE="
var items = [String]()
for line in lines {
if line.starts(with: summaryPrefix) {
if line.starts(with: extraPrefix) {
items[items.count-1].append(" \(line.dropFirst(extraPrefix.count))")
print("Found \(items.count) items.")
print(items.joined(separator: "\n"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.