Swiftlighter

Swift Syntax Highlighter


Swiftlighter is the Open Source project that distributes under the Apache 2.0 license. This app helps to translate swift text into a highlighted HTML/CSS listing for a web page, especially for web-sites running on Blogger engine. This app has been created for developers who aren't used to apply web markup languages or somehow can’t get a web engine access to set their code up. You can also use Swiftlighter if you don’t want to put substantial investments in time and energy for additional web settings.


Available for macOS Catalina and supports Swift 5.1

Enjoy free installation! (no subscription, no purchases)

Still don’t have Swiftlighter? Download now!

What is inside? Check on GitHub!

Current version: 2.8
Default example of its work:


class ExampleViewController: UIViewController {
    
    @IBOutlet var mainLabel: UILabel!
    @IBOutlet var neededTextField: UITextField!
    
    var currentText: String?

    override func viewDidLoad() {
        super.viewDidLoad()
        updateMainLabel()
    }
    
    @IBAction func sendButtonTapped(_ sender: UIButton){
        currentText = neededTextField.text
        updateMainLabel()
    }
    
    private func updateMainLabel(){
        guard let unwrappedCurrentText = currentText else {
            mainLabel.text = "Type any text"
            return
        }
        mainLabel.text = unwrappedCurrentText
    }
    /*
    // MARK: - New Functions
       1) Add animation
       2) Update backgrounds
    */
}

Set up by CSS field, used CSS code: font-family:sans-serif; border-radius:0px;


var someNum: Int? = nil
if let num = someNum{
    print("Hello \(num)")
}

Quick Start:
You don’t need any web knowledges to start. There are three steps for making swift code highlighted.

  1. Past or type a swift code into the Input Text Field:
    Swift Syntax Highlighter

    2.  Select a colour style for syntax highlighting. Translation will be done automatically.

    Colours Styles of Swiftlighter


    3.  Copy all the resulting code by one click and past it in HTML editor:

    Swiftlighter swift to html



Colour Customisation:

Swiftlighter supports users colour customisation. All you need is to choose between editing existing or adding a new colour style. If you want to add a new colour style that is based on existing one, you can choose any style you have on your colour panel and click “Add New” button. A new style will be based on an existing style and saved as new.

Swiftlighter customisation


For changing colour you need to type its hex value (as #123456, or 123456) in a text field, also you may click a colour button and choose a colour in the popover menu.

Swift highlighter colours




Palettes:

Using a web safe palette is recommended for identical display on different devices. However you can use any colour from RGB and Grayscale spaces. CMYK colour space is not recommended for using. Colours from “Developer” popover menu are not supported.

Supported Swiftlighter colours



Fonts and CSS:

For getting font customisation and adding your own CSS code click on the Font Profile button, choose any custom variant then click the “Edit Profile Button” when it’s enabled.

Swift highlighter fonts







If you can't find your favourite font in the popup menu, you can add a font setting “font-family: “My Favourite Font” into the CSS field:



Swift code font customisation



Note: Executes only the code that is located in the CSS field including font settings. Popup buttons and “Font Size” field only manipulate main CSS field!



You can change some installed parts of CSS code by adding into the CSS field your own code, new settings will automatically replace old. 

Parts that can be changed in <div style=“”> block: 



text-shadow; font-size; border-radius; border-width; padding; overflow; overflow-x; overflow-y; width; height;




Other CSS parts of code will be added into the <pre style = “”> block.



CSS code for swift syntax highlighter




By clicking “Save” button you will relaunch the engine and get a new result. If you want to clean up all the settings, click “Default Web Page Settings”.

Comments

Anonymous said…
Mate, it’s a great app! I was looking for an app like yours recently, but couldn’t find anything and now I found it. Finally! Thanks. Where I can support you?
Uberdeviant said…
Thanks for your reply, I'm happy to help you! Nowhere, just enjoy:)

Popular posts from this blog

Multiple Inheritance in Swift or Protocol Oriented Programming

We need to talk

Simple app for beginners. Nuked Code [0]