Decode a string encoded in Base64 into an https link and launch it in Google Chrome

Related tags

Utility Base64Decode
Overview

Decode a string encoded in Base64 into an https link and launch it in Google Chrome!

Yes, many websites and a two-or-three-liner in pyton/terminal can do the same job.

But a MacOS app can detect your paste board content and generate a neat web link / chrome launcher!

I actually learned a lot from this dumb little project (coming from 100% iOS development previously):

  • Interprocess communication between NSPasteBoard and sandboxed app

  • NSNotificationCenter pattern to detect pasteboard changes

    • in MacOS, we can't set an observer on NSPasteBoard (which is a functionality in iOS), so our choices are to poll (ask the pasteboard for the most current value every couple of seconds) or to ask at a specific time.
    • In this case, why not ask when we get the notification that the app is about to return to foreground status? i.e NSApplication.willBecomeActiveNotification. The user will need to switch to another app to copy the value anyway.
  • The tiny-yet-annoying-as-hell differences between developing an macOS vs iOS app. The macOS view's main window doesn't seem to play nicely with auto-layout in the same manner as in iOS. I still need to understand how to configure the stackview to generate a dynamic NSTextField based on a given text length.

  • Basic UI iteration: minimize visual elements and buttons/choices for the user. We don't have the luxury of writing an owner's manual so we gotta make the UI intuitive to use from first glance. Such a simple desire to convert base64 into a URL can actually lead to quite a bit of clutter:

    • do we display the full value in the paste board? Make it scrollable?
    • what about a button to refresh the paste board if our notification doesn't trigger for some reason?
    • what about another button to decode manually?
    • etc.
  • decoding a string via String(data:encoding):

    • we can decode our input string into a Data object with base64-encoding
    • and then pass this data object into the above initializer. Voila!
  • last but not least, executing a bash command via the Process class:

    • we just need to specify the location of bash: /user/bin/your command
    • and of course, your command's arguments
    • Process.run() even comes with a handy termination handler (completionHandler in iOS)

My god, it's been a while since I made a silly app for fun and negative profit. I need to do this more often.

You might also like...
Merges a given number of PDF files into one file using the PDFKit framework

Titanium iOS PDF Merge Merges a given number of PDF files into one file using the PDFKit framework Requirements iOS 11+ Titanium SDK 9+ API's Methods

Read iOS 15 privacy insight '.ndjson' file into your human brain.
Read iOS 15 privacy insight '.ndjson' file into your human brain.

Insight Read iOS 15 privacy insight '.ndjson' file into your human brain. Written in SwiftUI. Feature Compile records into app summary Relink app info

Passing data from a couple of screen into a Model
Passing data from a couple of screen into a Model

Passing-Data Passing data from a couple of screen into a Model Introduction Hi, this video is just a representation project from this Video by Essenti

AnalyticsKit for Swift is designed to combine various analytical services into one simple tool.

🦋 AnalyticsKit AnalyticsKit for Swift is designed to combine various analytical services into one simple tool. To send information about a custom eve

Parse iOS mobile provisioning files into Swift models

SwiftyProvisioningProfile This library provides a way to decode a .mobileprovision file into a Swift model. Installation The recommended installation

HxSTLParser is a basic STL parser capable of loading STL files into an SCNNode

HxSTLParser HxSTLParser is a basic STL parser capable of loading STL files into an SCNNode. Installing Via Carthage Just add it to your Cartfile githu

 Zip - A Swift framework for zipping and unzipping files. Simple and quick to use. Built on top of minizip.
Zip - A Swift framework for zipping and unzipping files. Simple and quick to use. Built on top of minizip.

Zip A Swift framework for zipping and unzipping files. Simple and quick to use. Built on top of minizip. Usage Import Zip at the top of the Swift file

C4 is an open-source creative coding framework that harnesses the power of native iOS programming with a simplified API that gets you working with media right away. Build artworks, design interfaces and explore new possibilities working with media and interaction.
Useful Swift code samples, extensions, functionalities and scripts to cherry-pick and use in your projects

SwiftyPick 🦅 🍒 Useful Swift code samples, extensions, functionalities and scripts to cherry-pick and use in your projects. Purpose The idea behind t

Owner
Jerry
Life, Liberty and the pursuit of App-yness
Jerry
CipherCode - iOS App to decode your secret message

CipherCode IOS App to decode/encode your secret message App App consist of welco

Doston Rustamov 0 Jan 15, 2022
Taking a string containing a csv file and split it into records (aka lines) containing fields of data (aka Array of SubStrings)

Swift .csv parser Taking a string containing a csv file and split it into records (aka lines) containing fields of data (aka Array of SubStrings). Par

Matthias 0 Dec 29, 2021
Add “Launch at Login” functionality to your macOS app in seconds

LaunchAtLogin Add “Launch at Login” functionality to your macOS app in seconds It's usually quite a convoluted and error-prone process to add this. No

Sindre Sorhus 1.3k Jan 6, 2023
Extendy - A set of useful string extensions.

Extendy A set of useful string extensions. Requirements iOS 11.0+ Swift 5+ Installation CocoaPods Extendy is available through CocoaPods. To install i

Anton Novichenko 3 Sep 23, 2021
This package will contain the standard encodings/decodings/hahsing used by the String Conversion Tool app.

This package will contain the standard encodings/decodings/hahsing used by the String Conversion Tool app. It will also, however, contain extra encoding/decoding methods (new encoding/decoding)

Gleb 0 Oct 16, 2021
EmbeddedStringsKit: Representation localized string in code

EmbeddedStringsKit Representation localized string in code Usage public struct L

Muukii 1 Jul 13, 2022
ParserCombinators - String Parser Construction Kit

ParserCombinators provides a set of elementary building blocks for deriving stru

Marcel Tesch 0 Jan 7, 2022
DGLabelSize - Functions that calculate the size of uilabel based on different string lengths

DGLabelSize Functions that calculate the size of uilabel based on different stri

donggyu 5 Jun 10, 2022
Google ProtocolBuffers for Apple Swift

Protocol Buffers for Swift An implementation of Protocol Buffers in Swift. Protocol Buffers are a way of encoding structured data in an efficient yet

Alexey Khokhlov 933 Nov 4, 2022
A Swift Encoder for encoding any Encodable value into an array of URLQueryItem.

URLQueryItemEncoder A Swift Encoder for encoding any Encodable value into an array of URLQueryItem. As part of the SE-0166, Swift has a foundation for

Pitiphong Phongpattranont 60 Aug 21, 2022