Skip to content

Commit bd731c6

Browse files
committed
Change Blur file to swift
1 parent 72b2614 commit bd731c6

File tree

8 files changed

+450
-438
lines changed

8 files changed

+450
-438
lines changed

ShadowView.podspec

Lines changed: 139 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,142 @@
1+
#
2+
# Be sure to run `pod spec lint ShadowView.podspec' to ensure this is a
3+
# valid spec and to remove all comments including this before submitting the spec.
4+
#
5+
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
6+
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
7+
#
8+
19
Pod::Spec.new do |s|
2-
s.name = 'ShadowView'
3-
s.version = '1.0'
4-
s.summary = 'ShadowView makes view\'s shadow implementation easy and sweet.'
5-
6-
s.description = <<-DESC
7-
Add simple shadows to add a gaussian blurred projection (as a shadow) to any UIView.
8-
DESC
9-
10-
s.homepage = 'https://github.com/PierrePerrin/ShadowView'
11-
s.license = { :type => 'MIT', :file => 'LICENSE' }
12-
s.author = { 'Pierre' => 'Perrin' }
13-
s.source = { :git => 'https://github.com/PierrePerrin/ShadowView.git', :tag => s.version.to_s }
14-
s.ios.deployment_target = '9.0'
15-
s.source_files = 'ShadowView/ShadowView/*{.h,.m,.swift}'
10+
11+
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
12+
#
13+
# These will help people to find your library, and whilst it
14+
# can feel like a chore to fill in it's definitely to your advantage. The
15+
# summary should be tweet-length, and the description more in depth.
16+
#
17+
18+
s.name = "ShadowView"
19+
s.version = "1.0"
20+
s.summary = "ShadowView makes view's shadow implementation easy and sweet"
21+
22+
# This description is used to generate tags and improve search results.
23+
# * Think: What does it do? Why did you write it? What is the focus?
24+
# * Try to keep it short, snappy and to the point.
25+
# * Write the description between the DESC delimiters below.
26+
# * Finally, don't worry about the indent, CocoaPods strips it!
27+
s.description = <<-DESC
28+
Add simple shadows or add a gaussian blurred projection (as a shadow) to any UIView.
29+
DESC
30+
31+
s.homepage = "https://github.com/PierrePerrin/ShadowView"
32+
# s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
33+
34+
35+
# ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
36+
#
37+
# Licensing your code is important. See http://choosealicense.com for more info.
38+
# CocoaPods will detect a license file if there is a named LICENSE*
39+
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
40+
#
41+
42+
#s.license = "MIT (example)"
43+
s.license = { :type => "MIT", :file => "LICENSE" }
44+
45+
46+
# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
47+
#
48+
# Specify the authors of the library, with email addresses. Email addresses
49+
# of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
50+
# accepts just a name if you'd rather not provide an email address.
51+
#
52+
# Specify a social_media_url where others can refer to, for example a twitter
53+
# profile URL.
54+
#
55+
56+
s.author = { "Pierre" => "pierreperrin@outlook.com" }
57+
# Or just: s.author = "Pierre"
58+
# s.authors = { "Pierre" => "pierreperrin@outlook.com" }
59+
# s.social_media_url = "http://twitter.com/Pierre"
60+
61+
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
62+
#
63+
# If this Pod runs only on iOS or OS X, then specify the platform and
64+
# the deployment target. You can optionally include the target after the platform.
65+
#
66+
67+
# s.platform = :ios
68+
s.platform = :ios, "9.0"
69+
70+
# When using multiple platforms
71+
# s.ios.deployment_target = "5.0"
72+
# s.osx.deployment_target = "10.7"
73+
# s.watchos.deployment_target = "2.0"
74+
# s.tvos.deployment_target = "9.0"
75+
76+
77+
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
78+
#
79+
# Specify the location from where the source should be retrieved.
80+
# Supports git, hg, bzr, svn and HTTP.
81+
#
82+
83+
s.source = { :git => "https://github.com/PierrePerrin/ShadowView.git", :tag => "#{s.version}" }
84+
85+
86+
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
87+
#
88+
# CocoaPods is smart about how it includes source code. For source files
89+
# giving a folder will include any swift, h, m, mm, c & cpp files.
90+
# For header files it will include any header in the folder.
91+
# Not including the public_header_files will make all headers public.
92+
#
93+
94+
s.source_files = "Sources", "ShadowView/ShadowView/"
95+
#s.exclude_files = "Classes/Exclude"
96+
97+
# s.public_header_files = "Classes/**/*.h"
98+
99+
100+
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
101+
#
102+
# A list of resources included with the Pod. These are copied into the
103+
# target bundle with a build phase script. Anything else will be cleaned.
104+
# You can preserve files from being cleaned, please don't preserve
105+
# non-essential files like tests, examples and documentation.
106+
#
107+
108+
# s.resource = "icon.png"
109+
# s.resources = "Resources/*.png"
110+
111+
# s.preserve_paths = "FilesToSave", "MoreFilesToSave"
112+
113+
114+
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
115+
#
116+
# Link your library with frameworks, or libraries. Libraries do not include
117+
# the lib prefix of their name.
118+
#
119+
120+
# s.framework = "SomeFramework"
121+
# s.frameworks = "SomeFramework", "AnotherFramework"
122+
s.frameworks = 'Foundation', 'UIKit'
123+
124+
# s.library = "iconv"
125+
# s.libraries = "iconv", "xml2"
126+
127+
128+
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
129+
#
130+
# If your library depends on compiler flags you can set them in the xcconfig hash
131+
# where they will only apply to your library. If you depend on other Podspecs
132+
# you can include multiple dependencies to ensure it works.
133+
134+
# s.requires_arc = true
135+
136+
# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
137+
# s.dependency "JSONKit", "~> 1.4"
138+
139+
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '3.1' }
140+
s.requires_arc = true
16141

17142
end

ShadowView/ShadowView.xcodeproj/project.pbxproj

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@
1919
F926E5131F27F1CA00EEE74E /* UIView+Image.swift in Sources */ = {isa = PBXBuildFile; fileRef = F926E5121F27F1CA00EEE74E /* UIView+Image.swift */; };
2020
F926E5141F27F25000EEE74E /* UIView+Image.swift in Sources */ = {isa = PBXBuildFile; fileRef = F926E5121F27F1CA00EEE74E /* UIView+Image.swift */; };
2121
F926E5161F27F38600EEE74E /* ShadowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F926E5151F27F38500EEE74E /* ShadowView.swift */; };
22-
F926E51A1F27F49400EEE74E /* UIImage+Blur.swift in Sources */ = {isa = PBXBuildFile; fileRef = F926E5191F27F49400EEE74E /* UIImage+Blur.swift */; };
23-
F926E51E1F27F57800EEE74E /* UIImageEffects.h in Headers */ = {isa = PBXBuildFile; fileRef = F926E51C1F27F57800EEE74E /* UIImageEffects.h */; };
24-
F926E51F1F27F57800EEE74E /* UIImageEffects.m in Sources */ = {isa = PBXBuildFile; fileRef = F926E51D1F27F57800EEE74E /* UIImageEffects.m */; };
25-
F926E5201F27F57800EEE74E /* UIImageEffects.m in Sources */ = {isa = PBXBuildFile; fileRef = F926E51D1F27F57800EEE74E /* UIImageEffects.m */; };
26-
F926E5221F27F68400EEE74E /* UIImage+Blur.swift in Sources */ = {isa = PBXBuildFile; fileRef = F926E5191F27F49400EEE74E /* UIImage+Blur.swift */; };
22+
F926E51A1F27F49400EEE74E /* UIImage+Size.swift in Sources */ = {isa = PBXBuildFile; fileRef = F926E5191F27F49400EEE74E /* UIImage+Size.swift */; };
23+
F926E5221F27F68400EEE74E /* UIImage+Size.swift in Sources */ = {isa = PBXBuildFile; fileRef = F926E5191F27F49400EEE74E /* UIImage+Size.swift */; };
2724
F926E5231F27F94300EEE74E /* ShadowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F926E5151F27F38500EEE74E /* ShadowView.swift */; };
2825
F926E5251F28F03100EEE74E /* sample.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F926E5241F28F03100EEE74E /* sample.jpg */; };
2926
F926E5261F28F03100EEE74E /* sample.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F926E5241F28F03100EEE74E /* sample.jpg */; };
@@ -33,6 +30,8 @@
3330
F926E52F1F29397000EEE74E /* ExampleProgViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F926E52D1F29397000EEE74E /* ExampleProgViewController.swift */; };
3431
F926E5311F29570900EEE74E /* ShadowView+BlurProcess.swift in Sources */ = {isa = PBXBuildFile; fileRef = F926E5301F29570900EEE74E /* ShadowView+BlurProcess.swift */; };
3532
F926E5321F29570900EEE74E /* ShadowView+BlurProcess.swift in Sources */ = {isa = PBXBuildFile; fileRef = F926E5301F29570900EEE74E /* ShadowView+BlurProcess.swift */; };
33+
F926E5341F298C5200EEE74E /* UIImageEffects.swift in Sources */ = {isa = PBXBuildFile; fileRef = F926E5331F298C5200EEE74E /* UIImageEffects.swift */; };
34+
F926E5351F298C5200EEE74E /* UIImageEffects.swift in Sources */ = {isa = PBXBuildFile; fileRef = F926E5331F298C5200EEE74E /* UIImageEffects.swift */; };
3635
/* End PBXBuildFile section */
3736

3837
/* Begin PBXContainerItemProxy section */
@@ -61,14 +60,13 @@
6160
F907D12C1F27ECB2007D4BE4 /* UIView+Shadow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Shadow.swift"; sourceTree = "<group>"; };
6261
F926E5121F27F1CA00EEE74E /* UIView+Image.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Image.swift"; sourceTree = "<group>"; };
6362
F926E5151F27F38500EEE74E /* ShadowView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShadowView.swift; sourceTree = "<group>"; };
64-
F926E5191F27F49400EEE74E /* UIImage+Blur.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+Blur.swift"; sourceTree = "<group>"; };
65-
F926E51C1F27F57800EEE74E /* UIImageEffects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIImageEffects.h; sourceTree = "<group>"; };
66-
F926E51D1F27F57800EEE74E /* UIImageEffects.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIImageEffects.m; sourceTree = "<group>"; };
63+
F926E5191F27F49400EEE74E /* UIImage+Size.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+Size.swift"; sourceTree = "<group>"; };
6764
F926E5241F28F03100EEE74E /* sample.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = sample.jpg; sourceTree = "<group>"; };
6865
F926E5271F290F1600EEE74E /* home2.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = home2.jpeg; sourceTree = "<group>"; };
6966
F926E52A1F29303A00EEE74E /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
7067
F926E52D1F29397000EEE74E /* ExampleProgViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExampleProgViewController.swift; sourceTree = "<group>"; };
7168
F926E5301F29570900EEE74E /* ShadowView+BlurProcess.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ShadowView+BlurProcess.swift"; sourceTree = "<group>"; };
69+
F926E5331F298C5200EEE74E /* UIImageEffects.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIImageEffects.swift; sourceTree = "<group>"; };
7270
/* End PBXFileReference section */
7371

7472
/* Begin PBXFrameworksBuildPhase section */
@@ -167,9 +165,8 @@
167165
F926E5181F27F48400EEE74E /* UIImageViewExtensions */ = {
168166
isa = PBXGroup;
169167
children = (
170-
F926E51C1F27F57800EEE74E /* UIImageEffects.h */,
171-
F926E51D1F27F57800EEE74E /* UIImageEffects.m */,
172-
F926E5191F27F49400EEE74E /* UIImage+Blur.swift */,
168+
F926E5331F298C5200EEE74E /* UIImageEffects.swift */,
169+
F926E5191F27F49400EEE74E /* UIImage+Size.swift */,
173170
);
174171
name = UIImageViewExtensions;
175172
sourceTree = "<group>";
@@ -181,7 +178,6 @@
181178
isa = PBXHeadersBuildPhase;
182179
buildActionMask = 2147483647;
183180
files = (
184-
F926E51E1F27F57800EEE74E /* UIImageEffects.h in Headers */,
185181
);
186182
runOnlyForDeploymentPostprocessing = 0;
187183
};
@@ -327,12 +323,12 @@
327323
buildActionMask = 2147483647;
328324
files = (
329325
F926E5131F27F1CA00EEE74E /* UIView+Image.swift in Sources */,
330-
F926E51A1F27F49400EEE74E /* UIImage+Blur.swift in Sources */,
331-
F926E51F1F27F57800EEE74E /* UIImageEffects.m in Sources */,
326+
F926E51A1F27F49400EEE74E /* UIImage+Size.swift in Sources */,
332327
F926E52E1F29397000EEE74E /* ExampleProgViewController.swift in Sources */,
333328
F926E5161F27F38600EEE74E /* ShadowView.swift in Sources */,
334329
F907D12D1F27ECB2007D4BE4 /* UIView+Shadow.swift in Sources */,
335330
F926E5311F29570900EEE74E /* ShadowView+BlurProcess.swift in Sources */,
331+
F926E5341F298C5200EEE74E /* UIImageEffects.swift in Sources */,
336332
);
337333
runOnlyForDeploymentPostprocessing = 0;
338334
};
@@ -349,10 +345,10 @@
349345
buildActionMask = 2147483647;
350346
files = (
351347
F907D11F1F27ECA3007D4BE4 /* ViewController.swift in Sources */,
352-
F926E5221F27F68400EEE74E /* UIImage+Blur.swift in Sources */,
348+
F926E5221F27F68400EEE74E /* UIImage+Size.swift in Sources */,
349+
F926E5351F298C5200EEE74E /* UIImageEffects.swift in Sources */,
353350
F926E52F1F29397000EEE74E /* ExampleProgViewController.swift in Sources */,
354351
F926E5141F27F25000EEE74E /* UIView+Image.swift in Sources */,
355-
F926E5201F27F57800EEE74E /* UIImageEffects.m in Sources */,
356352
F907D12E1F27ED24007D4BE4 /* UIView+Shadow.swift in Sources */,
357353
F926E5231F27F94300EEE74E /* ShadowView.swift in Sources */,
358354
F907D11D1F27ECA3007D4BE4 /* AppDelegate.swift in Sources */,
@@ -568,7 +564,6 @@
568564
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
569565
PRODUCT_BUNDLE_IDENTIFIER = PP.ShadowViewExample;
570566
PRODUCT_NAME = "$(TARGET_NAME)";
571-
SWIFT_OBJC_BRIDGING_HEADER = "ShadowView/ShadowViewExample-Bridging-Header.h";
572567
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
573568
SWIFT_VERSION = 3.0;
574569
};
@@ -584,7 +579,6 @@
584579
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
585580
PRODUCT_BUNDLE_IDENTIFIER = PP.ShadowViewExample;
586581
PRODUCT_NAME = "$(TARGET_NAME)";
587-
SWIFT_OBJC_BRIDGING_HEADER = "ShadowView/ShadowViewExample-Bridging-Header.h";
588582
SWIFT_VERSION = 3.0;
589583
};
590584
name = Release;

ShadowView/ShadowView/ShadowView+BlurProcess.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright © 2017 Pierreperrin. All rights reserved.
77
//
88

9-
import Foundation
9+
import UIKit
1010

1111
extension ShadowView{
1212

@@ -52,11 +52,10 @@ extension ShadowView{
5252
containerLayer.addSublayer(blurImageLayer)
5353

5454
let containerImage = containerLayer.asImage
55-
55+
5656
let resizeImageConstant :CGFloat = 1
5757
guard let resizedContainerImage = containerImage.resized(withPercentage: resizeImageConstant),
58-
let blurredImage = resizedContainerImage
59-
.applyBlur(blurRadius:blurRadius,fastProcessing:true, tintColor : self.shadowTintColor, saturationDeltaFactor: self.shadowSaturation)
58+
let blurredImage = resizedContainerImage.applyBlurWithRadius(blurRadius, tintColor: self.shadowTintColor, saturationDeltaFactor: self.shadowSaturation)
6059
else {
6160
return
6261
}

ShadowView/ShadowView/ShadowViewExample-Bridging-Header.h

Lines changed: 0 additions & 6 deletions
This file was deleted.

ShadowView/ShadowView/UIImage+Blur.swift renamed to ShadowView/ShadowView/UIImage+Size.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@ import UIKit
1111
extension UIImage{
1212

1313

14-
/// Apply Gaussian Blur to a ciimage, and return a UIImage
15-
///
16-
/// - Parameter ciimage: the imput CIImage
17-
/// - Returns: output UIImage
18-
func applyBlur(blurRadius:CGFloat,fastProcessing:Bool=true, tintColor:UIColor? = nil,saturationDeltaFactor:CGFloat) -> UIImage? {
19-
20-
return UIImageEffects.imageByApplyingBlur(to: self, withRadius: blurRadius, tintColor: tintColor, saturationDeltaFactor: saturationDeltaFactor, maskImage: nil)
21-
}
22-
2314
/// Resize the image to a centain percentage
2415
///
2516
/// - Parameter percentage: Percentage value

0 commit comments

Comments
 (0)