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
52972dae
Unverified
Commit
52972dae
authored
Sep 23, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: updated Card and ImageCard
parent
29eff722
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
379 additions
and
49 deletions
+379
-49
Examples/Material.xcworkspace/contents.xcworkspacedata
+3
-0
Examples/Programmatic/Card/Card/ViewController.swift
+8
-9
Examples/Programmatic/ImageCard/ImageCard.xcodeproj/project.pbxproj
+0
-0
Examples/Programmatic/ImageCard/ImageCard.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+7
-0
Examples/Programmatic/ImageCard/ImageCard/AppDelegate.swift
+45
-0
Examples/Programmatic/ImageCard/ImageCard/Assets.xcassets/AppIcon.appiconset/Contents.json
+94
-0
Examples/Programmatic/ImageCard/ImageCard/Assets.xcassets/Contents.json
+7
-0
Examples/Programmatic/ImageCard/ImageCard/Assets.xcassets/CosmicMind.imageset/Contents.json
+22
-0
Examples/Programmatic/ImageCard/ImageCard/Assets.xcassets/CosmicMind.imageset/CosmicMind.png
+0
-0
Examples/Programmatic/ImageCard/ImageCard/Base.lproj/LaunchScreen.storyboard
+27
-0
Examples/Programmatic/ImageCard/ImageCard/Info.plist
+44
-0
Examples/Programmatic/ImageCard/ImageCard/ViewController.swift
+100
-0
Sources/iOS/Card.swift
+22
-40
Sources/iOS/ImageCard.swift
+0
-0
No files found.
Examples/Material.xcworkspace/contents.xcworkspacedata
View file @
52972dae
...
@@ -23,6 +23,9 @@
...
@@ -23,6 +23,9 @@
location =
"group:Programmatic/Card/Card.xcodeproj"
>
location =
"group:Programmatic/Card/Card.xcodeproj"
>
</FileRef>
</FileRef>
<FileRef
<FileRef
location =
"group:Programmatic/ImageCard/ImageCard.xcodeproj"
>
</FileRef>
<FileRef
location =
"group:Programmatic/Layer/Layer.xcodeproj"
>
location =
"group:Programmatic/Layer/Layer.xcodeproj"
>
</FileRef>
</FileRef>
<FileRef
<FileRef
...
...
Examples/Programmatic/Card/Card/ViewController.swift
View file @
52972dae
...
@@ -32,7 +32,7 @@ import UIKit
...
@@ -32,7 +32,7 @@ import UIKit
import
Material
import
Material
class
ViewController
:
UIViewController
{
class
ViewController
:
UIViewController
{
private
var
t
itleB
ar
:
Toolbar
!
private
var
t
oolb
ar
:
Toolbar
!
private
var
contentView
:
UILabel
!
private
var
contentView
:
UILabel
!
private
var
bottomBar
:
Bar
!
private
var
bottomBar
:
Bar
!
private
var
favoriteButton
:
IconButton
!
private
var
favoriteButton
:
IconButton
!
...
@@ -41,18 +41,18 @@ class ViewController: UIViewController {
...
@@ -41,18 +41,18 @@ class ViewController: UIViewController {
super
.
viewDidLoad
()
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten5
view
.
backgroundColor
=
Color
.
grey
.
lighten5
prepareT
itleB
ar
()
prepareT
oolb
ar
()
prepareContentView
()
prepareContentView
()
prepareFavoriteButton
()
prepareFavoriteButton
()
prepareBottomBar
()
prepareBottomBar
()
prepareCard
()
prepareCard
()
}
}
private
func
prepareT
itleB
ar
()
{
private
func
prepareT
oolb
ar
()
{
t
itleB
ar
=
Toolbar
()
t
oolb
ar
=
Toolbar
()
t
itleB
ar
.
title
=
"Title"
t
oolb
ar
.
title
=
"Title"
t
itleB
ar
.
detail
=
"Detail Description"
t
oolb
ar
.
detail
=
"Detail Description"
t
itleB
ar
.
backgroundColor
=
nil
t
oolb
ar
.
backgroundColor
=
nil
}
}
private
func
prepareContentView
()
{
private
func
prepareContentView
()
{
...
@@ -75,8 +75,7 @@ class ViewController: UIViewController {
...
@@ -75,8 +75,7 @@ class ViewController: UIViewController {
private
func
prepareCard
()
{
private
func
prepareCard
()
{
let
card
=
Card
()
let
card
=
Card
()
card
.
pulseAnimation
=
.
pointWithBacking
card
.
toolbar
=
toolbar
card
.
titleBar
=
titleBar
card
.
contentView
=
contentView
card
.
contentView
=
contentView
card
.
bottomBar
=
bottomBar
card
.
bottomBar
=
bottomBar
...
...
Examples/Programmatic/ImageCard/ImageCard.xcodeproj/project.pbxproj
0 → 100644
View file @
52972dae
This diff is collapsed.
Click to expand it.
Examples/Programmatic/ImageCard/ImageCard.xcodeproj/project.xcworkspace/contents.xcworkspacedata
0 → 100644
View file @
52972dae
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version =
"1.0"
>
<FileRef
location =
"self:ImageCard.xcodeproj"
>
</FileRef>
</Workspace>
Examples/Programmatic/ImageCard/ImageCard/AppDelegate.swift
0 → 100644
View file @
52972dae
/*
* 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
import
Material
@UIApplicationMain
class
AppDelegate
:
UIResponder
,
UIApplicationDelegate
{
var
window
:
UIWindow
?
func
applicationDidFinishLaunching
(
_
application
:
UIApplication
)
{
window
=
UIWindow
(
frame
:
Device
.
bounds
)
window
!.
rootViewController
=
ViewController
()
window
!.
makeKeyAndVisible
()
}
}
Examples/Programmatic/ImageCard/ImageCard/Assets.xcassets/AppIcon.appiconset/Contents.json
0 → 100644
View file @
52972dae
{
"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"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
Examples/Programmatic/ImageCard/ImageCard/Assets.xcassets/Contents.json
0 → 100644
View file @
52972dae
{
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
Examples/Programmatic/ImageCard/ImageCard/Assets.xcassets/CosmicMind.imageset/Contents.json
0 → 100644
View file @
52972dae
{
"images"
:
[
{
"idiom"
:
"universal"
,
"filename"
:
"CosmicMind.png"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
Examples/Programmatic/ImageCard/ImageCard/Assets.xcassets/CosmicMind.imageset/CosmicMind.png
0 → 100644
View file @
52972dae
16.9 KB
Examples/Programmatic/ImageCard/ImageCard/Base.lproj/LaunchScreen.storyboard
0 → 100644
View file @
52972dae
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"11134"
systemVersion=
"15F34"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
launchScreen=
"YES"
useTraitCollections=
"YES"
colorMatched=
"YES"
initialViewController=
"01J-lp-oVM"
>
<dependencies>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"11106"
/>
<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"
>
<layoutGuides>
<viewControllerLayoutGuide
type=
"top"
id=
"Llm-lL-Icb"
/>
<viewControllerLayoutGuide
type=
"bottom"
id=
"xb3-aO-Qok"
/>
</layoutGuides>
<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"
/>
</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>
Examples/Programmatic/ImageCard/ImageCard/Info.plist
0 → 100644
View file @
52972dae
<
?xml
v
e
rsion="
1
.
0
"
e
n
c
o
d
ing="UT
F
-
8
"?
>
<
!
D
O
C
TYP
E
plist
PU
B
LI
C
"-//
A
ppl
e
//
D
T
D
PLIST
1
.
0
//
E
N"
"http://www.
a
ppl
e
.
c
om/
D
T
D
s/Prop
e
rtyList-
1
.
0
.
d
t
d
"
>
<
plist
v
e
rsion="
1
.
0
"
>
<
d
i
c
t
>
<
k
e
y
>
CFBundleDevelopmentRegion
<
/k
e
y
>
<
string
>
en
<
/string
>
<
k
e
y
>
CFBundleExecutable
<
/k
e
y
>
<
string
>
$
(
EXECUTABLE_NAME
)<
/string
>
<
k
e
y
>
CFBundleIdentifier
<
/k
e
y
>
<
string
>
$
(
PRODUCT_BUNDLE_IDENTIFIER
)<
/string
>
<
k
e
y
>
CFBundleInfoDictionaryVersion
<
/k
e
y
>
<
string
>
6.0
<
/string
>
<
k
e
y
>
CFBundleName
<
/k
e
y
>
<
string
>
$
(
PRODUCT_NAME
)<
/string
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
APPL
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
1.0
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
1
<
/string
>
<
k
e
y
>
LSRequiresIPhoneOS
<
/k
e
y
>
<
tru
e
/
>
<
k
e
y
>
UILaunchStoryboardName
<
/k
e
y
>
<
string
>
LaunchScreen
<
/string
>
<
k
e
y
>
UIRequiredDeviceCapabilities
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
armv7
<
/string
>
<
/
a
rr
a
y
>
<
k
e
y
>
UISupportedInterfaceOrientations
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
UIInterfaceOrientationPortrait
<
/string
>
<
string
>
UIInterfaceOrientationLandscapeLeft
<
/string
>
<
string
>
UIInterfaceOrientationLandscapeRight
<
/string
>
<
string
>
UIInterfaceOrientationPortraitUpsideDown
<
/string
>
<
/
a
rr
a
y
>
<
k
e
y
>
UISupportedInterfaceOrientations
~
ipad
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
UIInterfaceOrientationPortrait
<
/string
>
<
string
>
UIInterfaceOrientationPortraitUpsideDown
<
/string
>
<
string
>
UIInterfaceOrientationLandscapeLeft
<
/string
>
<
string
>
UIInterfaceOrientationLandscapeRight
<
/string
>
<
/
a
rr
a
y
>
<
/
d
i
c
t
>
<
/plist
>
Examples/Programmatic/ImageCard/ImageCard/ViewController.swift
0 → 100644
View file @
52972dae
/*
* 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
import
Material
class
ViewController
:
UIViewController
{
private
var
imageView
:
UIImageView
!
private
var
toolbar
:
Toolbar
!
private
var
contentView
:
UILabel
!
private
var
bottomBar
:
Bar
!
private
var
favoriteButton
:
IconButton
!
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten5
prepareImageView
()
prepareToolbar
()
prepareContentView
()
prepareFavoriteButton
()
prepareBottomBar
()
prepareImageCard
()
}
private
func
prepareImageView
()
{
imageView
=
UIImageView
()
imageView
.
image
=
UIImage
(
named
:
"CosmicMind"
)
imageView
.
clipsToBounds
=
true
imageView
.
contentMode
=
.
scaleAspectFit
}
private
func
prepareToolbar
()
{
toolbar
=
Toolbar
()
toolbar
.
title
=
"Title"
toolbar
.
titleLabel
.
textAlignment
=
.
left
toolbar
.
detail
=
"Detail Description"
toolbar
.
detailLabel
.
textAlignment
=
.
left
toolbar
.
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
prepareFavoriteButton
()
{
favoriteButton
=
IconButton
(
image
:
Icon
.
favorite
,
tintColor
:
Color
.
blue
.
base
)
favoriteButton
.
pulseColor
=
Color
.
blue
.
base
}
private
func
prepareBottomBar
()
{
bottomBar
=
Bar
()
bottomBar
.
backgroundColor
=
nil
bottomBar
.
leftViews
=
[
favoriteButton
]
}
private
func
prepareImageCard
()
{
let
card
=
ImageCard
()
card
.
imageView
=
imageView
card
.
toolbar
=
toolbar
card
.
contentView
=
contentView
card
.
bottomBar
=
bottomBar
view
.
layout
(
card
)
.
top
(
100
)
.
left
(
20
)
.
right
(
20
)
}
}
Sources/iOS/Card.swift
View file @
52972dae
...
@@ -59,28 +59,9 @@ open class Card: PulseView {
...
@@ -59,28 +59,9 @@ open class Card: PulseView {
}
}
}
}
/// A preset wrapper around interimSpace.
/// A reference to the toolbar.
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
layoutSubviews
()
}
}
/// A reference to the titleBar.
@IBInspectable
@IBInspectable
open
var
t
itleB
ar
:
Toolbar
?
{
open
var
t
oolb
ar
:
Toolbar
?
{
didSet
{
didSet
{
layoutSubviews
()
layoutSubviews
()
}
}
...
@@ -125,13 +106,13 @@ open class Card: PulseView {
...
@@ -125,13 +106,13 @@ open class Card: PulseView {
/**
/**
A convenience initiazlier.
A convenience initiazlier.
- Parameter t
itleB
ar: An optional Toolbar.
- Parameter t
oolb
ar: An optional Toolbar.
- Parameter contentView: An optional UIView.
- Parameter contentView: An optional UIView.
- Parameter bottomBar: An optional Bar.
- Parameter bottomBar: An optional Bar.
*/
*/
public
convenience
init
?(
t
itleB
ar
:
Toolbar
?,
contentView
:
UIView
?,
bottomBar
:
Bar
?)
{
public
convenience
init
?(
t
oolb
ar
:
Toolbar
?,
contentView
:
UIView
?,
bottomBar
:
Bar
?)
{
self
.
init
(
frame
:
.
zero
)
self
.
init
(
frame
:
.
zero
)
prepareProperties
(
t
itleBar
:
titleB
ar
,
contentView
:
contentView
,
bottomBar
:
bottomBar
)
prepareProperties
(
t
oolbar
:
toolb
ar
,
contentView
:
contentView
,
bottomBar
:
bottomBar
)
}
}
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
...
@@ -146,25 +127,30 @@ open class Card: PulseView {
...
@@ -146,25 +127,30 @@ open class Card: PulseView {
v
.
removeFromSuperview
()
v
.
removeFromSuperview
()
}
}
var
format
=
"V:|-(top)"
layout
()
}
/// Lays out view.
open
func
layout
()
{
var
format
=
"V:|"
var
views
=
[
String
:
Any
]()
var
views
=
[
String
:
Any
]()
if
let
v
=
t
itleB
ar
{
if
let
v
=
t
oolb
ar
{
format
+=
"
-[titleB
ar]"
format
+=
"
[toolb
ar]"
views
[
"t
itleB
ar"
]
=
v
views
[
"t
oolb
ar"
]
=
v
layout
(
v
)
.
horizontally
(
left
:
contentEdgeInsets
.
left
,
right
:
contentEdgeInsets
.
right
)
layout
(
v
)
.
horizontally
()
}
}
if
let
v
=
contentView
{
if
let
v
=
contentView
{
format
+=
(
nil
==
titleBar
?
""
:
"-(interimSpace)"
)
+
"-[contentView]
"
format
+=
"-(top)-[contentView]-(bottom)-
"
views
[
"contentView"
]
=
v
views
[
"contentView"
]
=
v
layout
(
v
)
.
horizontally
(
left
:
contentEdgeInsets
.
left
,
right
:
contentEdgeInsets
.
right
)
layout
(
v
)
.
horizontally
(
left
:
contentEdgeInsets
.
left
,
right
:
contentEdgeInsets
.
right
)
}
}
if
let
v
=
bottomBar
{
if
let
v
=
bottomBar
{
format
+=
(
nil
==
titleBar
&&
nil
==
contentView
?
""
:
"-(interimSpace)"
)
+
"-
[bottomBar]"
format
+=
"
[bottomBar]"
views
[
"bottomBar"
]
=
v
views
[
"bottomBar"
]
=
v
layout
(
v
)
.
horizontally
(
left
:
contentEdgeInsets
.
left
,
right
:
contentEdgeInsets
.
right
)
layout
(
v
)
.
horizontally
()
}
}
guard
0
<
views
.
count
else
{
guard
0
<
views
.
count
else
{
...
@@ -174,9 +160,8 @@ open class Card: PulseView {
...
@@ -174,9 +160,8 @@ open class Card: PulseView {
var
metrics
=
[
String
:
Any
]()
var
metrics
=
[
String
:
Any
]()
metrics
[
"top"
]
=
contentEdgeInsets
.
top
metrics
[
"top"
]
=
contentEdgeInsets
.
top
metrics
[
"bottom"
]
=
contentEdgeInsets
.
bottom
metrics
[
"bottom"
]
=
contentEdgeInsets
.
bottom
metrics
[
"interimSpace"
]
=
interimSpace
addConstraints
(
Layout
.
constraint
(
format
:
"
\(
format
)
-(bottom)-
|"
,
options
:
[],
metrics
:
metrics
,
views
:
views
))
addConstraints
(
Layout
.
constraint
(
format
:
"
\(
format
)
|"
,
options
:
[],
metrics
:
metrics
,
views
:
views
))
}
}
/**
/**
...
@@ -189,20 +174,17 @@ open class Card: PulseView {
...
@@ -189,20 +174,17 @@ open class Card: PulseView {
open
override
func
prepare
()
{
open
override
func
prepare
()
{
super
.
prepare
()
super
.
prepare
()
depthPreset
=
.
depth1
depthPreset
=
.
depth1
pulseAnimation
=
.
none
contentEdgeInsetsPreset
=
.
square1
interimSpacePreset
=
.
interimSpace3
cornerRadiusPreset
=
.
cornerRadius1
cornerRadiusPreset
=
.
cornerRadius1
}
}
/**
/**
A preparation method that sets the base UI elements.
A preparation method that sets the base UI elements.
- Parameter t
itleB
ar: An optional Toolbar.
- Parameter t
oolb
ar: An optional Toolbar.
- Parameter contentView: An optional UIView.
- Parameter contentView: An optional UIView.
- Parameter bottomBar: An optional Bar.
- Parameter bottomBar: An optional Bar.
*/
*/
internal
func
prepareProperties
(
t
itleB
ar
:
Toolbar
?,
contentView
:
UIView
?,
bottomBar
:
Bar
?)
{
internal
func
prepareProperties
(
t
oolb
ar
:
Toolbar
?,
contentView
:
UIView
?,
bottomBar
:
Bar
?)
{
self
.
t
itleBar
=
titleB
ar
self
.
t
oolbar
=
toolb
ar
self
.
contentView
=
contentView
self
.
contentView
=
contentView
self
.
bottomBar
=
bottomBar
self
.
bottomBar
=
bottomBar
}
}
...
...
Sources/iOS/ImageCard.swift
View file @
52972dae
This diff is collapsed.
Click to expand it.
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