A simple framework to output to a file, url, the console, or even register notification using UserNotifications

Overview

o

Output and Input

What is o?

o is a simple framework to output to a file, url, the console, or even register notification using UserNotifications. o can also get input from a file, url, or console.

Where can o be used?

Currently, o can be used on macOS, iOS, and watchOS.

Examples

o.console

o.console.out("Value to print: ", terminator: "") //    (oTests/oTests.swift@7) [testExample()]: Value to print:
o.console.out(o.console.in()) // Type in "???";         (oTests/oTests.swift@8) [testExample()]: Optional("???")

o.file

let filename: String = ...

// Write the value 4, an Int, to the file named `filename`. Files using o.file are base64Encoded.
try o.file.out(4, filename: filename)

// Asserts
XCTAssertNoThrow(try o.file.in(filename: filename) as Int)
XCTAssertEqual(try? o.file.in(filename: filename), 4)

// Delete the File
try o.file.delete(filename: filename)

// Assert deletion
XCTAssertThrowsError(try o.file.in(filename: filename) as Int)

o.url

struct Post: Codable {
    let userId: Int
    let id: Int
    let title: String
    let body: String
}

// GET Request

o.url.in(
    url: URL(string: "api/posts")!,
    successHandler: { (posts: [Post], response) in
        print(posts)
    }
)

// POST Request

let post = Post(userId: 1, id: 1, title: "First!", body: "")

try o.url.out(
    url: URL(string: "api/posts/\(post.id)")!,
    value: post,
    successHandler: { data, response in
        print(response)
    }
)

o.notification

// Request Notification Authorization 
o.notification.requestAuthorization()

// Set UNUserNotificationCenter.current's delegate to `o.notification.delegate`
o.notification.registerDelegate()

// Schedule a Notification
o.notification.post(
    title: "Hello!",
    subtitle: "o.notification",
    body: "Woo Hoo!",
    trigger: UNTimeIntervalNotificationTrigger(
        timeInterval: 3,
        repeats: false
    )
)
You might also like...
A gem which can gen VFS YAML file.

yaml-vfs A gem which can gen VFS YAML file. vfs yamlwriter lets you create clang opt "-ivfsoverlay" ymal file, map virtual path to real path. ✅ It can

A ARM macOS Virtual Machine, using macOS 12's new Virtualization framework.
A ARM macOS Virtual Machine, using macOS 12's new Virtualization framework.

macOS Virtual Machine A ARM macOS Virtual Machine, using macOS 12's new Virtualization framework. I copied KhaosT's code from here, all I did is chang

macOS Virtual Machine using Virtualization.framework

virtualOS Run a virtual macOS machine on your Apple Silicon computer. On first start, the latest macOS restore image is automatically downloaded from

A simple composition framework to create transformations that are either unidirectional or bidirectional

c is a simple composition framework. You have the ability to create transformations that are either unidirectional or bidirectional. There is also a cache that values can be set and resolved.

An alternative to using the native UIAlertController, with a thoughtful design and simple implementation.
An alternative to using the native UIAlertController, with a thoughtful design and simple implementation.

HPAlertController An alternative to using the native UIAlertController, with a thoughtful design and simple implementation. Requirements iOS 15.0 and

A simple program to fix doubled key presses on macOS using just software

Untap A simple program to fix doubled key presses on macOS using just software. Installation Download this GitHub repo, cd to its folder in Terminal,

Start your next Open-Source Swift Framework 📦
Start your next Open-Source Swift Framework 📦

SwiftKit enables you to easily generate a cross platform Swift Framework from your command line. It is the best way to start your next Open-Source Swi

Easily generate cross platform Swift framework projects from the command line
Easily generate cross platform Swift framework projects from the command line

SwiftPlate Easily generate cross platform Swift framework projects from the command line. SwiftPlate will generate Xcode projects for you in seconds,

A Swift wrapper around the CoreSymbolication private framework on macOS.

CoreSymbolication provides a very powerful system for looking up and extracting symbolic information from mach-o executables, dyld shared caches, and dSYMs.

Comments
  • Implement Async/ Await for URL

    Implement Async/ Await for URL

    Right now o.url only supports completion blocks. Also it only supports GET and POST. We want to be able to use Swift's async/ await features. We will want to keep the completion block functions if async/ await isn't supported in some cases.

    opened by 0xLeif 1
Releases(0.3.0)
  • 0.3.0(Dec 17, 2022)

    What's Changed

    • Prefer full async solution to URL. by @0xLeif in https://github.com/0xOpenBytes/o/pull/2
    struct Post: Codable {
        let userId: Int
        let id: Int
        let title: String
        let body: String
    }
    
    // GET Request
    
    let (data, response) = try await o.url.get(
        url: URL(string: "api/posts")!
    )
    
    // POST Request
    
    let post = Post(userId: 1, id: 1, title: "First!", body: "")
    
    let (_, response) = try await o.url.post(
        url: URL(string: "api/posts/\(post.id)")!,
        body: try? JSONEncoder().encode(post)
    )
    
    print(response)
    

    Full Changelog: https://github.com/0xOpenBytes/o/compare/0.2.1...0.3.0

    Source code(tar.gz)
    Source code(zip)
  • 0.2.1(Apr 28, 2022)

    Full Changelog: https://github.com/0xOpenBytes/o/compare/0.2.0...0.2.1

    o

    Output and Input

    What is o?

    o is a simple framework to output to a file, url, the console, or even register notification using UserNotifications. o can also get input from a file, url, or console.

    Where can o be used?

    Currently, o can be used on macOS, iOS, and watchOS.

    Examples

    o.console

    o.console.out("Value to print: ", terminator: "") //    (oTests/oTests.swift@7) [testExample()]: Value to print:
    o.console.out(o.console.in()) // Type in "???";         (oTests/oTests.swift@8) [testExample()]: Optional("???")
    

    o.file

    let filename: String = ...
    
    // Write the value 4, an Int, to the file named `filename`. Files using o.file are base64Encoded.
    try o.file.out(4, filename: filename)
    
    // Asserts
    XCTAssertNoThrow(try o.file.in(filename: filename) as Int)
    XCTAssertEqual(try? o.file.in(filename: filename), 4)
    
    // Delete the File
    try o.file.delete(filename: filename)
    
    // Assert deletion
    XCTAssertThrowsError(try o.file.in(filename: filename) as Int)
    

    o.url

    struct Post: Codable {
        let userId: Int
        let id: Int
        let title: String
        let body: String
    }
    
    // GET Request
    
    o.url.in(
        url: URL(string: "api/posts")!,
        successHandler: { (posts: [Post], response) in
            print(posts)
        }
    )
    
    // POST Request
    
    let post = Post(userId: 1, id: 1, title: "First!", body: "")
    
    try o.url.out(
        url: URL(string: "api/posts/\(post.id)")!,
        value: post,
        successHandler: { data, response in
            print(response)
        }
    )
    

    o.notification

    // Request Notification Authorization 
    o.notification.requestAuthorization()
    
    // Set UNUserNotificationCenter.current's delegate to `o.notification.delegate`
    o.notification.registerDelegate()
    
    // Schedule a Notification
    o.notification.post(
        title: "Hello!",
        subtitle: "o.notification",
        body: "Woo Hoo!",
        trigger: UNTimeIntervalNotificationTrigger(
            timeInterval: 3,
            repeats: false
        )
    )
    
    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Mar 22, 2022)

    @0xLeif

    Full Changelog: https://github.com/0xOpenBytes/o/compare/0.1.0...0.2.0

    o

    Output and Input

    What is o?

    o is a simple framework to output to a file, url, the console, or even register notification using UserNotifications. o can also get input from a file, url, or console.

    Where can o be used?

    Currently, o can be used on macOS, iOS, and watchOS.

    Examples

    o.console

    o.console.out("Value to print: ", terminator: "") //    (oTests/oTests.swift@7) [testExample()]: Value to print:
    o.console.out(o.console.in()) // Type in "???";         (oTests/oTests.swift@8) [testExample()]: Optional("???")
    

    o.file

    let filename: String = ...
    
    // Write the value 4, an Int, to the file named `filename`. Files using o.file are base64Encoded.
    try o.file.out(4, filename: filename)
    
    // Asserts
    XCTAssertNoThrow(try o.file.in(filename: filename) as Int)
    XCTAssertEqual(try? o.file.in(filename: filename), 4)
    
    // Delete the File
    try o.file.delete(filename: filename)
    
    // Assert deletion
    XCTAssertThrowsError(try o.file.in(filename: filename) as Int)
    

    o.url

    struct Post: Codable {
        let userId: Int
        let id: Int
        let title: String
        let body: String
    }
    
    // GET Request
    
    o.url.in(
        url: URL(string: "api/posts")!,
        successHandler: { (posts: [Post], response) in
            print(posts)
        }
    )
    
    // POST Request
    
    let post = Post(userId: 1, id: 1, title: "First!", body: "")
    
    try o.url.out(
        url: URL(string: "api/posts/\(post.id)")!,
        value: post,
        successHandler: { data, response in
            print(response)
        }
    )
    

    o.notification

    // Request Notification Authorization 
    o.notification.requestAuthorization()
    
    // Set UNUserNotificationCenter.current's delegate to `o.notification.delegate`
    o.notification.registerDelegate()
    
    // Schedule a Notification
    o.notification.post(
        title: "Hello!",
        subtitle: "o.notification",
        body: "Woo Hoo!",
        trigger: UNTimeIntervalNotificationTrigger(
            timeInterval: 3,
            repeats: false
        )
    )
    
    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Mar 18, 2022)

    o

    Output and Input

    What is o?

    o is a simple framework to output to a file, url, the console, or even register notification using UserNotifications. o can also get input from a file, url, or console.

    Where can o be used?

    Currently, o can be used on macOS, iOS, and watchOS.

    Examples

    o.console

    o.console.out("Value to print: ", terminator: "") //    (oTests/oTests.swift@7) [testExample()]: Value to print:
    o.console.out(o.console.in()) // Type in "???";         (oTests/oTests.swift@8) [testExample()]: Optional("???")
    

    o.file

    let filename: String = ...
    
    // Write the value 4, an Int, to the file named `filename`. Files using o.file are base64Encoded.
    try o.file.out(4, filename: filename)
    
    // Asserts
    XCTAssertNoThrow(try o.file.in(filename: filename) as Int)
    XCTAssertEqual(try? o.file.in(filename: filename), 4)
    
    // Delete the File
    try o.file.delete(filename: filename)
    
    // Assert deletion
    XCTAssertThrowsError(try o.file.in(filename: filename) as Int)
    

    o.url

    struct Post: Codable {
        let userId: Int
        let id: Int
        let title: String
        let body: String
    }
    
    // GET Request
    
    o.url.in(
        url: URL(string: "api/posts")!,
        successHandler: { (posts: [Post], response) in
            print(posts)
        }
    )
    
    // POST Request
    
    let post = Post(userId: 1, id: 1, title: "First!", body: "")
    
    try o.url.out(
        url: URL(string: "api/posts/\(post.id)")!,
        value: post,
        successHandler: { data, response in
            print(response)
        }
    )
    

    o.notification

    // Request Notification Authorization 
    o.notification.requestAuthorization()
    
    // Set UNUserNotificationCenter.current's delegate to `o.notification.delegate`
    o.notification.registerDelegate()
    
    // Schedule a Notification
    o.notification.post(
        title: "Hello!",
        subtitle: "o.notification",
        body: "Woo Hoo!",
        trigger: UNTimeIntervalNotificationTrigger(
            timeInterval: 3,
            repeats: false
        )
    )
    
    Source code(tar.gz)
    Source code(zip)
Owner
OpenBytes
OpenBytes
Capacitor File Opener. The plugin is able to open a file given the mimeType and the file uri

Capacitor File Opener. The plugin is able to open a file given the mimeType and the file uri. This plugin is similar to cordova-plugin-file-opener2 without installation support.

Capacitor Community 32 Dec 21, 2022
An example implementation of using a native iOS Notification Service Extension (to display images in remote push notification) in Titanium.

Titanium iOS Notification Service Extension An example implementation of using a native iOS Notification Service Extension (to display images in remot

Hans Knöchel 8 Nov 21, 2022
A macOS application for accessing the output of the SimpleAnalytics package on the desktop.

The SimpleAnalytics package allows you to collect data user interaction analytic data in iOS and macOS applications. This SimpleAnalytics Reader app project allows you to more easily make sense of that collected data by displaying it on your Mac.

Dennis Birch 10 Dec 22, 2022
Receive keyboard input even when Unity.app is in the background with no focus on macOS.

UnityAppEventMonitor Unity Native Plugin for NSEvent.addGlobalMonitorForEvents. Receive keyboard input even when Unity.app is in the background with n

fuziki 6 Aug 26, 2022
DataTaskPublisher extension that logs the request and response to the console

NetworkLogger Extension of Combine's DataTaskPublisher that logs the request and response to the console. Usage URLSession.shared.dataTaskPublisher(fo

Lukáš Hromadník 5 Dec 26, 2021
SyntaxTree - This code attempts to make basic syntax trees in the Xcode console

SyntaxTree This code attempts to make basic syntax trees in the Xcode console. I

Yash 0 Feb 12, 2022
iOS & tvOS multi-emulator frontend, supporting various Atari, Bandai, NEC, Nintendo, Sega, SNK and Sony console systems

iOS & tvOS multi-emulator frontend, supporting various Atari, Bandai, NEC, Nintendo, Sega, SNK and Sony console systems… Get Started: https://wiki.provenance-emu.com |

Provenance Emu 5.1k Dec 31, 2022
A simple Swift sample code to reads ISO 10303-21 exchange structure (STEP P21) file for AP242 schema.

simpleP21ReadSample A simple sample code to reads ISO 10303-21 exchange structure (STEP P21) file for AP242 schema. by Tsutomu Yoshida, Minokamo Japan

Tsutomu Yoshida 1 Nov 23, 2021
Asset Catalog Viewer allows you to browse and export renditions in an asset catalog (.car) file.

Asset Catalog Viewer With the Asset Catalog Viewer Mac app, you can browse and export various type of renditions in an asset catalog. Features Browse

Joey 16 Jan 1, 2023
The starting file for the 360iDev "It's Widget Time" workshop.

360iDevWidgets_start The starting file for the 360iDev "It's Widget Time" workshop. Syllabus This is a workshop to introduce you to adding widgets to

Steve Lipton 5 Dec 29, 2021