A small menubar app that allows you to switch between R versions quickly (if you have multiple versions of R framework installed). https://rud.is/rswitch
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

50 lines
1.0 KiB

//
// RStudioServerSession.swift
// RSwitch
//
// Created by hrbrmstr on 9/5/19.
// Copyright © 2019 Bob Rudis. All rights reserved.
//
import Foundation
import Cocoa
class RStudioServerSession : Codable {
var url : String
var menuTitle : String
var wk : NSWindowController?
var wv : WebViewController?
private enum CodingKeys: String, CodingKey {
case url
case menuTitle
}
init(url: String, title: String) {
self.url = url
self.menuTitle = title
self.wk = nil
self.wv = nil
}
func show() {
let appDelegate = NSApplication.shared.delegate as! AppDelegate
let mainStoryboard = appDelegate.mainStoryboard!
if (wk == nil) {
wk = (mainStoryboard.instantiateController(withIdentifier: "wkPanelController") as! NSWindowController)
wv = wk!.window?.contentViewController as? WebViewController
wv!.url = url
wv!.nickname = menuTitle
}
wk?.window?.orderFront(appDelegate)
wk?.showWindow(appDelegate)
NSApp.activate(ignoringOtherApps: true)
}
}