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
ff98daff
Commit
ff98daff
authored
Jun 13, 2018
by
Orkhan Alikhanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added UIColor convenience initializers
parent
abccb7b1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
0 deletions
+64
-0
Material.xcodeproj/project.pbxproj
+4
-0
Sources/iOS/Material+UIColor.swift
+60
-0
No files found.
Material.xcodeproj/project.pbxproj
View file @
ff98daff
...
...
@@ -181,6 +181,7 @@
9DF352441FED20ED00B2A11B
/* RadioButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9DF352431FED20ED00B2A11B
/* RadioButton.swift */
;
};
9DF352461FED210000B2A11B
/* CheckButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9DF352451FED210000B2A11B
/* CheckButton.swift */
;
};
9DF58CEE20C098C60098968D
/* ErrorTextFieldValidator.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9DF58CED20C098C60098968D
/* ErrorTextFieldValidator.swift */
;
};
9DF74C4E20D15D84003C1D66
/* Material+UIColor.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9DF74C4D20D15D84003C1D66
/* Material+UIColor.swift */
;
};
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
...
...
@@ -299,6 +300,7 @@
9DF352431FED20ED00B2A11B
/* RadioButton.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RadioButton.swift
;
sourceTree
=
"<group>"
;
};
9DF352451FED210000B2A11B
/* CheckButton.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CheckButton.swift
;
sourceTree
=
"<group>"
;
};
9DF58CED20C098C60098968D
/* ErrorTextFieldValidator.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ErrorTextFieldValidator.swift
;
sourceTree
=
"<group>"
;
};
9DF74C4D20D15D84003C1D66
/* Material+UIColor.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIColor.swift"
;
sourceTree
=
"<group>"
;
};
/* End PBXFileReference section */
/* Begin PBXGroup section */
...
...
@@ -699,6 +701,7 @@
962864591D53FE3E00690B69
/* Material+UIWindow.swift */
,
966C17721F0439F600D3E83C
/* Material+MotionAnimation.swift */
,
9618006C1F4D384200CD77A1
/* Material+UIViewController.swift */
,
9DF74C4D20D15D84003C1D66
/* Material+UIColor.swift */
,
);
name
=
Extension
;
sourceTree
=
"<group>"
;
...
...
@@ -1027,6 +1030,7 @@
965E80DB1DD4C50600D61E4B
/* InterimSpace.swift in Sources */
,
965E80DC1DD4C50600D61E4B
/* Depth.swift in Sources */
,
965E80DD1DD4C50600D61E4B
/* EdgeInsets.swift in Sources */
,
9DF74C4E20D15D84003C1D66
/* Material+UIColor.swift in Sources */
,
965E80DE1DD4C50600D61E4B
/* Gravity.swift in Sources */
,
965E80DF1DD4C50600D61E4B
/* CornerRadius.swift in Sources */
,
965E80FB1DD4D59500D61E4B
/* SearchBar.swift in Sources */
,
...
...
Sources/iOS/Material+UIColor.swift
0 → 100644
View file @
ff98daff
/*
* Copyright (C) 2018, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.com>.
* All rights reserved.
*
* Original Inspiration & Author
* Copyright (C) 2018 Orkhan Alikhanov <orkhan.alikhanov@gmail.com>
*
* 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
public
extension
UIColor
{
/**
A convenience initializer that creates color from
argb(alpha red green blue) hexadecimal representation.
- Parameter argb: An unsigned 32 bit integer. E.g 0xFFAA44CC.
*/
convenience
init
(
argb
:
UInt32
)
{
let
a
=
argb
>>
24
let
r
=
argb
>>
16
let
g
=
argb
>>
8
let
b
=
argb
>>
0
func
f
(
_
v
:
UInt32
)
->
CGFloat
{
return
CGFloat
(
v
&
0xff
)
/
255
}
self
.
init
(
red
:
f
(
r
),
green
:
f
(
g
),
blue
:
f
(
b
),
alpha
:
f
(
a
))
}
/**
A convenience initializer that creates color from
rgb(red green blue) hexadecimal representation with alpha value 1.
- Parameter rgb: An unsigned 32 bit integer. E.g 0xAA44CC.
*/
convenience
init
(
rgb
:
UInt32
)
{
self
.
init
(
argb
:
(
UInt32
(
0xff000000
))
|
rgb
)
}
}
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