Skip to content

Commit

Permalink
Merge branch 'release/3.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krüger committed Oct 20, 2016
2 parents 265c020 + 096ee89 commit 8a3755f
Show file tree
Hide file tree
Showing 25 changed files with 850 additions and 829 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Version 3.0.0

- [x] Swift 3 compatibility

## Version 2.0.0

- [x] New Repository structure
Expand Down
14 changes: 7 additions & 7 deletions Manuscript-Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,34 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

self.window = UIWindow(frame:UIScreen.mainScreen().bounds)
self.window = UIWindow(frame:UIScreen.main.bounds)
self.window?.rootViewController = UINavigationController(rootViewController: MainViewController())
self.window?.makeKeyAndVisible()

return true
}

func applicationWillResignActive(application: UIApplication) {
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(application: UIApplication) {
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(application: UIApplication) {
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(application: UIApplication) {
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(application: UIApplication) {
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,27 @@ class SimpleButtonExampleViewController: UIViewController {

// MARK: Private Properties

private var activeButton: UIButton? = nil
fileprivate var activeButton: UIButton? = nil

private let optionA: UIButton = UIButton(type: .System)
private let optionB: UIButton = UIButton(type: .System)
private let optionC: UIButton = UIButton(type: .System)
fileprivate let optionA: UIButton = UIButton(type: .system)
fileprivate let optionB: UIButton = UIButton(type: .system)
fileprivate let optionC: UIButton = UIButton(type: .system)

private let buttonDimSmall:CGFloat = 60.0
private let buttonDimBig:CGFloat = 80.0
fileprivate let buttonDimSmall:CGFloat = 60.0
fileprivate let buttonDimBig:CGFloat = 80.0

private var optionAHeight: NSLayoutConstraint? = nil
private var optionAWidth: NSLayoutConstraint? = nil
private var optionBHeight: NSLayoutConstraint? = nil
private var optionBWidth: NSLayoutConstraint? = nil
private var optionCHeight: NSLayoutConstraint? = nil
private var optionCWidth: NSLayoutConstraint? = nil
fileprivate var optionAHeight: NSLayoutConstraint? = nil
fileprivate var optionAWidth: NSLayoutConstraint? = nil
fileprivate var optionBHeight: NSLayoutConstraint? = nil
fileprivate var optionBWidth: NSLayoutConstraint? = nil
fileprivate var optionCHeight: NSLayoutConstraint? = nil
fileprivate var optionCWidth: NSLayoutConstraint? = nil

// MARK: - Init

init() {
super.init(nibName: nil, bundle: nil)
self.title = "Buttons"
title = "Buttons"
}

required init(coder aDecoder: NSCoder) {
Expand All @@ -62,100 +62,100 @@ class SimpleButtonExampleViewController: UIViewController {
override func loadView() {
super.loadView()

self.view.backgroundColor = UIColor.grayColor()
view.backgroundColor = UIColor.gray

self.setupSubviews()
self.setupLayout()
setupSubviews()
setupLayout()
}

// MARK: - Target

func buttonPressed(sender: UIButton) {
if sender == self.activeButton {
func buttonPressed(_ sender: UIButton) {
if sender == activeButton {
return;
}

if let activeButton = self.activeButton {
if let activeButton = activeButton {
switch activeButton {
case self.optionA:
self.optionAHeight?.constant = self.buttonDimSmall
self.optionAWidth?.constant = self.buttonDimSmall
self.optionA.setNeedsLayout()
case self.optionB:
self.optionBHeight?.constant = self.buttonDimSmall
self.optionBWidth?.constant = self.buttonDimSmall
self.optionB.setNeedsLayout()
case self.optionC:
self.optionCHeight?.constant = self.buttonDimSmall
self.optionCWidth?.constant = self.buttonDimSmall
self.optionC.setNeedsLayout()
case optionA:
optionAHeight?.constant = buttonDimSmall
optionAWidth?.constant = buttonDimSmall
optionA.setNeedsLayout()
case optionB:
optionBHeight?.constant = buttonDimSmall
optionBWidth?.constant = buttonDimSmall
optionB.setNeedsLayout()
case optionC:
optionCHeight?.constant = buttonDimSmall
optionCWidth?.constant = buttonDimSmall
optionC.setNeedsLayout()
default:
print("active button is unknown")
}
}

switch sender {
case self.optionA:
self.optionAHeight?.constant = self.buttonDimBig
self.optionAWidth?.constant = self.buttonDimBig
self.optionA.setNeedsLayout()
case self.optionB:
self.optionBHeight?.constant = self.buttonDimBig
self.optionBWidth?.constant = self.buttonDimBig
self.optionB.setNeedsLayout()
case self.optionC:
self.optionCHeight?.constant = self.buttonDimBig
self.optionCWidth?.constant = self.buttonDimBig
self.optionC.setNeedsLayout()
case optionA:
optionAHeight?.constant = buttonDimBig
optionAWidth?.constant = buttonDimBig
optionA.setNeedsLayout()
case optionB:
optionBHeight?.constant = buttonDimBig
optionBWidth?.constant = buttonDimBig
optionB.setNeedsLayout()
case optionC:
optionCHeight?.constant = buttonDimBig
optionCWidth?.constant = buttonDimBig
optionC.setNeedsLayout()
default:
print("sender button is unknown")
}

self.activeButton = sender
activeButton = sender

UIView.animateWithDuration(0.25) {
UIView.animate(withDuration: 0.25, animations: {
self.view.layoutIfNeeded()
}
})
}

// MARK: - Setup & Layout

private func setupSubviews() {
self.optionA.backgroundColor = UIColor.whiteColor()
self.optionA.setTitle("A", forState: .Normal)
self.optionA.addTarget(self, action: #selector(SimpleButtonExampleViewController.buttonPressed(_:)), forControlEvents: .TouchUpInside)
self.view.addSubview(self.optionA)

self.optionB.backgroundColor = UIColor.whiteColor()
self.optionB.setTitle("B", forState: .Normal)
self.optionB.addTarget(self, action: #selector(SimpleButtonExampleViewController.buttonPressed(_:)), forControlEvents: .TouchUpInside)
self.view.addSubview(self.optionB)

self.optionC.backgroundColor = UIColor.whiteColor()
self.optionC.setTitle("C", forState: .Normal)
self.optionC.addTarget(self, action: #selector(SimpleButtonExampleViewController.buttonPressed(_:)), forControlEvents: .TouchUpInside)
self.view.addSubview(self.optionC)
fileprivate func setupSubviews() {
optionA.backgroundColor = UIColor.white
optionA.setTitle("A", for: UIControlState())
optionA.addTarget(self, action: #selector(SimpleButtonExampleViewController.buttonPressed(_:)), for: .touchUpInside)
view.addSubview(optionA)

optionB.backgroundColor = UIColor.white
optionB.setTitle("B", for: UIControlState())
optionB.addTarget(self, action: #selector(SimpleButtonExampleViewController.buttonPressed(_:)), for: .touchUpInside)
view.addSubview(optionB)

optionC.backgroundColor = UIColor.white
optionC.setTitle("C", for: UIControlState())
optionC.addTarget(self, action: #selector(SimpleButtonExampleViewController.buttonPressed(_:)), for: .touchUpInside)
view.addSubview(optionC)
}

private func setupLayout() {
Manuscript.layout(self.optionA) { c in
self.optionAHeight = c.set(.Height, to:self.buttonDimSmall).constraint
self.optionAWidth = c.set(.Width, to:self.buttonDimSmall).constraint
c.make(.Right, equalTo:self.optionB, s:.Left, minus: 10.0)
c.make(.CenterY, equalTo:self.view, s:.CenterY)
fileprivate func setupLayout() {
Manuscript.layout(optionA) { c in
optionAHeight = c.set(.height, to:buttonDimSmall).constraint
optionAWidth = c.set(.width, to:buttonDimSmall).constraint
c.make(.right, equalTo:optionB, s:.left, minus: 10.0)
c.make(.centerY, equalTo:view, s:.centerY)
}

Manuscript.layout(self.optionB) { c in
self.optionBHeight = c.set(.Height, to:self.buttonDimSmall).constraint
self.optionBWidth = c.set(.Width, to:self.buttonDimSmall).constraint
c.centerIn(self.view)
Manuscript.layout(optionB) { c in
optionBHeight = c.set(.height, to:buttonDimSmall).constraint
optionBWidth = c.set(.width, to:buttonDimSmall).constraint
c.centerIn(view)
}

Manuscript.layout(self.optionC) { c in
self.optionCHeight = c.set(.Height, to:self.buttonDimSmall).constraint
self.optionCWidth = c.set(.Width, to:self.buttonDimSmall).constraint
c.make(.Left, equalTo:self.optionB, s:.Right, plus: 10.0)
c.make(.CenterY, equalTo:self.view, s:.CenterY)
Manuscript.layout(optionC) { c in
optionCHeight = c.set(.height, to:buttonDimSmall).constraint
optionCWidth = c.set(.width, to:buttonDimSmall).constraint
c.make(.left, equalTo:optionB, s:.right, plus: 10.0)
c.make(.centerY, equalTo:view, s:.centerY)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down Expand Up @@ -30,6 +40,16 @@
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
Expand Down

This file was deleted.

6 changes: 6 additions & 0 deletions Manuscript-Example/Images.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
4 changes: 1 addition & 3 deletions Manuscript-Example/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.1.0</string>
<string>3.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand All @@ -24,8 +24,6 @@
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
Loading

0 comments on commit 8a3755f

Please sign in to comment.