Skip to content

Commit

Permalink
Initial import of framework.
Browse files Browse the repository at this point in the history
  • Loading branch information
jayeshk committed Feb 7, 2019
1 parent 7c068da commit a9021ca
Show file tree
Hide file tree
Showing 234 changed files with 66,158 additions and 17 deletions.
12 changes: 12 additions & 0 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
author: Jay K
author_url: https://github.com/jayeshk/Doric
github_url: https://github.com/jayeshk/Doric
root_url: https://github.com/jayeshk/Doric/
module: Doric
output: docs
theme: apple
xcodebuild_arguments: [-project, 'Doric.xcodeproj', -scheme, 'Doric']
theme: apple
exclude:
- './Source/Debug+Preview.swift'
documentation: Documentation/*.md
8 changes: 8 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
##included:
## - Source
disabled_rules: # rule identifiers to exclude from running
- colon
- line_length

excluded: # paths to ignore during linting. Takes precedence over `included`.
- Source/Debug+Preview.swift
507 changes: 507 additions & 0 deletions Demo/Catalogue/Catalogue.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 63 additions & 0 deletions Demo/Catalogue/Catalogue/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Doric
//
// Copyright (c) 2019 Jay K.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import Doric
import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var themeManager: DualThemeManager!

func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
prepareToolkit()
prepareThemeManager()
registerForThemeNotification()

if let nController = self.window?.rootViewController as? UINavigationController {
let navigationBar = nController.navigationBar
navigationBar.applyStyle(navigationStyle: AppNavigationStyle.regular)
}

return true
}

func prepareToolkit() {
Doric.shared.settings = Settings(spacing: Space.p1)
Doric.shared.isHidden = true
}

func prepareThemeManager() {
themeManager = DualThemeManager(mainTheme: DemoPrimaryTheme(), alternateTheme: DemoSecondaryTheme())
}

func registerForThemeNotification() {
NotificationCenter.default.addObserver(self, selector: #selector(onThemeChanged(_:)), name: ThemeNotification.didChange, object: nil)
}

@objc func onThemeChanged(_ notification: Notification) {
guard let theme = notification.theme else {
return
}
DemoDesignSystem.colorPalette = theme.colorPalette
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
6 changes: 6 additions & 0 deletions Demo/Catalogue/Catalogue/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "grand-canyon.jpg",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "template-icon.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions Demo/Catalogue/Catalogue/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
69 changes: 69 additions & 0 deletions Demo/Catalogue/Catalogue/BaseViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Doric
//
// Copyright (c) 2019 Jay K.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import Doric
import UIKit

class BaseViewController: UIViewController {
override var preferredStatusBarStyle: UIStatusBarStyle { return UIStatusBarStyle.lightContent }

func embedInScrollView() -> UIScrollView {
let scrollView = UIScrollView()
view.addSubview(scrollView)
scrollView.bounces = true
scrollView.anchorEdges(view)
scrollView.backgroundColor = UIColor.clear
return scrollView
}

override func viewDidLoad() {
super.viewDidLoad()
registerForThemeNotification()
prepareForStyle()
}

func prepareForStyle() {
view.applyStyle(viewStyle: AppViewStyle.main)
}

func presentOptions(_ alert: UIAlertController, barButtonItem: UIBarButtonItem? = nil) {
alert.view.tintColor = DemoDesignSystem.colorPalette.black
if traitCollection.userInterfaceIdiom == .pad {
alert.popoverPresentationController?.barButtonItem = barButtonItem
}
present(alert, animated: true, completion: nil)
}

func registerForThemeNotification() {
NotificationCenter.default.addObserver(self, selector: #selector(onThemeChanged(_:)), name: ThemeNotification.didChange, object: nil)
}
@objc func onThemeChanged(_ notification: Notification) {
guard let theme = notification.theme else {
return
}
updateUIOnThemeChange(theme)
}

func updateUIOnThemeChange(_: Theme) {
prepareForStyle()
}
}
Loading

0 comments on commit a9021ca

Please sign in to comment.