Skip to content
This repository has been archived by the owner. It is now read-only.
Create web pages for Vapor in Swift.
Swift HTML CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Sources/UIWebKit
Tests
docs
icons
site
.gitignore
.hound.yml
.swiftlint.yml
.travis.yml
CONTRIBUTING.md
LICENSE
Package.pins
Package.swift
README.md

README.md

UIWebKit Icon

UIWebKit

Build Status Documentation Coverage

Create UI's for Vapor without HTML.

Example:

Create a class to control the creation of a web page:

import Foundation
import UIWebKit
import Vapor

final class MainView: UIWebPage {

    override func configure() {
        addSectionText()
        addHead()
    }

    func addSectionText() {
        let content = UIElement(element: Element.p)
        content.add("Text")
        content.attributes["style"] = "font-family: Roboto, sans-serif;"
        for _ in 0...10 {
            section.add(content)
        }
    }

    func addHead() {
        let title = UIElement(element: .title)
        title.add("UIWebKit Example")
        let link = UIElement(element: .link)
        link.attributes["rel"] = "stylesheet"
        link.attributes["href"] = "https://fonts.googleapis.com/css?family=Roboto"
        head.add(title)
        head.add(link)
    }
}

Use the class to create the page:

drop.get("about") { req in
    return MainView()
}

Documentation:

You can get the API documentation here.

Contributing:

Read the contribution guidlines here.

License:

All code is under the MIT license agreement.

You can’t perform that action at this time.