Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
141e5838
Unverified
Commit
141e5838
authored
Sep 22, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: added Card project with latest Card component
parent
f714cc4c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
187 deletions
+33
-187
Examples/Programmatic/Card/Card.xcodeproj/project.pbxproj
+0
-6
Examples/Programmatic/Card/Card/ViewController.swift
+33
-22
Material.xcodeproj/project.pbxproj
+0
-6
Sources/iOS/Card.swift
+0
-0
Sources/iOS/ContentCard.swift
+0
-153
No files found.
Examples/Programmatic/Card/Card.xcodeproj/project.pbxproj
View file @
141e5838
...
...
@@ -11,8 +11,6 @@
96B5B02B1D936DBC00449DDD
/* ViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96B5B02A1D936DBC00449DDD
/* ViewController.swift */
;
};
96B5B0301D936DBC00449DDD
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96B5B02F1D936DBC00449DDD
/* Assets.xcassets */
;
};
96B5B0331D936DBC00449DDD
/* LaunchScreen.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96B5B0311D936DBC00449DDD
/* LaunchScreen.storyboard */
;
};
96B5B03B1D937E5400449DDD
/* Material.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96B5B03A1D937E5400449DDD
/* Material.framework */
;
};
96B5B03C1D937E5400449DDD
/* Material.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96B5B03A1D937E5400449DDD
/* Material.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
...
...
@@ -22,7 +20,6 @@
dstPath
=
""
;
dstSubfolderSpec
=
10
;
files
=
(
96B5B03C1D937E5400449DDD
/* Material.framework in Embed Frameworks */
,
);
name
=
"Embed Frameworks"
;
runOnlyForDeploymentPostprocessing
=
0
;
...
...
@@ -36,7 +33,6 @@
96B5B02F1D936DBC00449DDD
/* Assets.xcassets */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
folder.assetcatalog
;
path
=
Assets.xcassets
;
sourceTree
=
"<group>"
;
};
96B5B0321D936DBC00449DDD
/* Base */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file.storyboard
;
name
=
Base
;
path
=
Base.lproj/LaunchScreen.storyboard
;
sourceTree
=
"<group>"
;
};
96B5B0341D936DBC00449DDD
/* Info.plist */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.plist.xml
;
path
=
Info.plist
;
sourceTree
=
"<group>"
;
};
96B5B03A1D937E5400449DDD
/* Material.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
path
=
Material.framework
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
...
...
@@ -44,7 +40,6 @@
isa
=
PBXFrameworksBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
96B5B03B1D937E5400449DDD
/* Material.framework in Frameworks */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
...
...
@@ -54,7 +49,6 @@
96B5B01C1D936DBC00449DDD
=
{
isa
=
PBXGroup
;
children
=
(
96B5B03A1D937E5400449DDD
/* Material.framework */
,
96B5B0271D936DBC00449DDD
/* Card */
,
96B5B0261D936DBC00449DDD
/* Products */
,
);
...
...
Examples/Programmatic/Card/Card/ViewController.swift
View file @
141e5838
...
...
@@ -32,44 +32,55 @@ import UIKit
import
Material
class
ViewController
:
UIViewController
{
private
var
titleBar
:
Toolbar
!
private
var
contentView
:
UILabel
!
private
var
bottomBar
:
Bar
!
private
var
favoriteButton
:
IconButton
!
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
white
view
.
backgroundColor
=
Color
.
grey
.
lighten5
prepareTitleBar
()
prepareContentView
()
prepareFavoriteButton
()
prepareBottomBar
()
prepareCard
()
}
private
func
prepareFavoriteButton
()
{
favoriteButton
=
IconButton
(
image
:
Icon
.
favorite
,
tintColor
:
Color
.
white
)
favoriteButton
.
pulseColor
=
Color
.
white
private
func
prepareTitleBar
()
{
titleBar
=
Toolbar
()
titleBar
.
title
=
"Title"
titleBar
.
backgroundColor
=
nil
}
private
func
prepareContentView
()
{
contentView
=
UILabel
()
contentView
.
numberOfLines
=
0
contentView
.
text
=
"It’s been a while, have you read any new books lately?"
contentView
.
font
=
RobotoFont
.
regular
(
with
:
14
)
}
private
func
prepareCard
()
{
view
.
backgroundColor
=
Color
.
white
let
card
=
ContentCard
()
card
.
depthPreset
=
.
depth2
card
.
titleBar
=
Toolbar
()
card
.
titleBar
?
.
title
=
"Title"
card
.
titleBar
?
.
backgroundColor
=
Color
.
red
.
base
private
func
prepareFavoriteButton
()
{
favoriteButton
=
IconButton
(
image
:
Icon
.
favorite
,
tintColor
:
Color
.
blue
.
base
)
favoriteButton
.
pulseColor
=
Color
.
blue
.
base
}
card
.
contentView
.
backgroundColor
=
Color
.
grey
.
base
card
.
contentView
.
height
=
300
private
func
prepareBottomBar
()
{
bottomBar
=
Bar
()
bottomBar
.
backgroundColor
=
nil
bottomBar
.
leftViews
=
[
favoriteButton
]
}
card
.
bottomBar
=
Bar
()
card
.
bottomBar
?
.
backgroundColor
=
Color
.
blue
.
base
card
.
bottomBar
?
.
contentEdgeInsetsPreset
=
.
square1
card
.
bottomBar
?
.
rightViews
=
[
favoriteButton
]
private
func
prepareCard
()
{
let
card
=
Card
()
card
.
pulseAnimation
=
.
pointWithBacking
let
button
=
FlatButton
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
100
,
height
:
100
))
card
.
contentView
.
addSubview
(
button
)
card
.
titleBar
=
titleBar
card
.
contentView
=
contentView
card
.
bottomBar
=
bottomBar
_
=
view
.
layout
(
card
)
.
left
(
20
)
.
right
(
20
)
.
top
(
10
0
)
view
.
layout
(
card
)
.
top
(
100
)
.
left
(
20
)
.
right
(
2
0
)
}
}
Material.xcodeproj/project.pbxproj
View file @
141e5838
...
...
@@ -13,7 +13,6 @@
96264BE71D833D2800576F37
/* Reminders.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96264BE61D833D2800576F37
/* Reminders.swift */
;
};
96264BE91D833D3400576F37
/* RemindersController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96264BE81D833D3400576F37
/* RemindersController.swift */
;
};
96264C0E1D84051900576F37
/* Checkbox.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96264C0D1D84051900576F37
/* Checkbox.swift */
;
};
96264C121D840B5F00576F37
/* ContentCard.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96264C111D840B5F00576F37
/* ContentCard.swift */
;
};
9628645A1D53FE3E00690B69
/* Material+UIWindow.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
962864591D53FE3E00690B69
/* Material+UIWindow.swift */
;
};
9628645F1D540AF300690B69
/* DynamicFontType.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9628645E1D540AF300690B69
/* DynamicFontType.swift */
;
};
962864621D54111D00690B69
/* JSON.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
962864611D54111D00690B69
/* JSON.swift */
;
};
...
...
@@ -32,7 +31,6 @@
968C99471D377849000074FF
/* Offset.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
968C99461D377849000074FF
/* Offset.swift */
;
};
9697F7B71D8F22A4004741EC
/* MenuItem.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9697F7B61D8F22A4004741EC
/* MenuItem.swift */
;
};
9697F7BC1D8F2572004741EC
/* BasicAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96E3C39D1D3A1D0C0086A024
/* BasicAnimation.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9697F7BD1D8F2572004741EC
/* ContentCard.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96264C111D840B5F00576F37
/* ContentCard.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9697F7BE1D8F2572004741EC
/* Checkbox.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96264C0D1D84051900576F37
/* Checkbox.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9697F7BF1D8F2572004741EC
/* Divider.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96230AB71D6A520C00AF47DC
/* Divider.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9697F7C01D8F2572004741EC
/* Material+CALayer.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96F1DC871D654FDF0025F925
/* Material+CALayer.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
...
...
@@ -225,7 +223,6 @@
96264BE61D833D2800576F37
/* Reminders.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Reminders.swift
;
sourceTree
=
"<group>"
;
};
96264BE81D833D3400576F37
/* RemindersController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RemindersController.swift
;
sourceTree
=
"<group>"
;
};
96264C0D1D84051900576F37
/* Checkbox.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Checkbox.swift
;
sourceTree
=
"<group>"
;
};
96264C111D840B5F00576F37
/* ContentCard.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ContentCard.swift
;
sourceTree
=
"<group>"
;
};
962864591D53FE3E00690B69
/* Material+UIWindow.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIWindow.swift"
;
sourceTree
=
"<group>"
;
};
9628645E1D540AF300690B69
/* DynamicFontType.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DynamicFontType.swift
;
sourceTree
=
"<group>"
;
};
962864611D54111D00690B69
/* JSON.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
JSON.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -630,7 +627,6 @@
96BCB8021CB40F3B00C806FE
/* Card */
=
{
isa
=
PBXGroup
;
children
=
(
96264C111D840B5F00576F37
/* ContentCard.swift */
,
96BCB75D1CB40DC500C806FE
/* Card.swift */
,
96BCB7621CB40DC500C806FE
/* ImageCard.swift */
,
);
...
...
@@ -871,7 +867,6 @@
96E3C39A1D3A1CC20086A024
/* ErrorTextField.swift in Headers */
,
96E3C39C1D3A1CC20086A024
/* Offset.swift in Headers */
,
9697F7BC1D8F2572004741EC
/* BasicAnimation.swift in Headers */
,
9697F7BD1D8F2572004741EC
/* ContentCard.swift in Headers */
,
9697F7BE1D8F2572004741EC
/* Checkbox.swift in Headers */
,
9697F7BF1D8F2572004741EC
/* Divider.swift in Headers */
,
9697F7C01D8F2572004741EC
/* Material+CALayer.swift in Headers */
,
...
...
@@ -1156,7 +1151,6 @@
96BCB7CD1CB40DC500C806FE
/* PulseView.swift in Sources */
,
96BCB7DA1CB40DC500C806FE
/* NavigationController.swift in Sources */
,
96BCB7A81CB40DC500C806FE
/* FabButton.swift in Sources */
,
96264C121D840B5F00576F37
/* ContentCard.swift in Sources */
,
96BCB7E41CB40DC500C806FE
/* Text.swift in Sources */
,
96BCB7AB1CB40DC500C806FE
/* ImageCard.swift in Sources */
,
96BCB7CB1CB40DC500C806FE
/* PulseAnimation.swift in Sources */
,
...
...
Sources/iOS/Card.swift
View file @
141e5838
This diff is collapsed.
Click to expand it.
Sources/iOS/ContentCard.swift
deleted
100644 → 0
View file @
f714cc4c
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import
UIKit
open
class
ContentCard
:
PulseView
{
/// Will render the view.
open
var
willLayout
:
Bool
{
return
0
<
width
&&
nil
!=
superview
}
/// A preset wrapper around contentInset.
open
var
contentEdgeInsetsPreset
:
EdgeInsetsPreset
{
get
{
return
grid
.
contentEdgeInsetsPreset
}
set
(
value
)
{
grid
.
contentEdgeInsetsPreset
=
value
}
}
/// A wrapper around grid.contentInset.
@IBInspectable
open
var
contentEdgeInsets
:
EdgeInsets
{
get
{
return
grid
.
contentEdgeInsets
}
set
(
value
)
{
grid
.
contentEdgeInsets
=
value
}
}
/// A preset wrapper around interimSpace.
open
var
interimSpacePreset
=
InterimSpacePreset
.
none
{
didSet
{
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
}
}
/// A wrapper around grid.interimSpace.
@IBInspectable
open
var
interimSpace
:
InterimSpace
{
get
{
return
grid
.
interimSpace
}
set
(
value
)
{
grid
.
interimSpace
=
value
}
}
/// A reference to the titleBar.
open
var
titleBar
:
Toolbar
?
{
didSet
{
layoutSubviews
()
}
}
/// A reference to the contentView.
open
var
contentView
=
UIView
()
{
didSet
{
layoutSubviews
()
}
}
/// A reference to the bottomBar.
open
var
bottomBar
:
Bar
?
{
didSet
{
layoutSubviews
()
}
}
/// Grid cell factor.
@IBInspectable
open
var
gridFactor
:
CGFloat
=
24
{
didSet
{
assert
(
0
<
gridFactor
,
"[Material Error: gridFactor must be greater than 0.]"
)
layoutSubviews
()
}
}
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepare method
to initialize property values and other setup operations.
The super.prepare method should always be called immediately
when subclassing.
*/
open
override
func
prepare
()
{
super
.
prepare
()
pulseAnimation
=
.
none
}
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
guard
willLayout
else
{
return
}
// clear constraints so new ones do not conflict
removeConstraints
(
constraints
)
for
v
in
subviews
{
v
.
removeFromSuperview
()
}
var
views
=
[
String
:
Any
]()
var
format
=
"V:|"
if
let
v
=
titleBar
{
views
[
"titleBar"
]
=
v
format
+=
"[titleBar]"
layout
(
v
)
.
horizontally
()
}
views
[
"contentView"
]
=
contentView
format
+=
"[contentView]"
layout
(
contentView
)
.
horizontally
()
// if let v = bottomBar {
// views["bottomBar"] = v
// format += "[bottomBar]"
// layout(v).horizontally()
// }
addConstraints
(
Layout
.
constraint
(
format
:
"
\(
format
)
|"
,
options
:
[],
metrics
:
nil
,
views
:
views
))
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment