Skip to content

Commit

Permalink
Merge pull request #371 from f3dm76/task/shadows
Browse files Browse the repository at this point in the history
Fix #34: Implement DropShadow effect rendering
ystrot authored May 30, 2018
2 parents e5dbc44 + 978bba0 commit 4907cc3
Showing 21 changed files with 542 additions and 200 deletions.
20 changes: 20 additions & 0 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -15,6 +15,9 @@
575129B61CBD14AF00BD3C2E /* AnimationsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 575129B51CBD14AF00BD3C2E /* AnimationsView.swift */; };
57AF398C1E67E9DB00F0BFE2 /* EventsExampleController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57AF398B1E67E9DB00F0BFE2 /* EventsExampleController.swift */; };
58E4D50C1D841C6E00EC8815 /* TransformExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58E4D50B1D841C6E00EC8815 /* TransformExampleView.swift */; };
5B1AE0F920B58575007EECCB /* SVGExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B1AE0F720B58574007EECCB /* SVGExampleViewController.swift */; };
5B1AE0FA20B58575007EECCB /* SVGViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B1AE0F820B58574007EECCB /* SVGViewController.swift */; };
5B1AE0FC20B5859E007EECCB /* shadows.svg in Resources */ = {isa = PBXBuildFile; fileRef = 5B1AE0FB20B5859E007EECCB /* shadows.svg */; };
66AE19DB1CC8CB3C00B78B5E /* tiger.svg in Resources */ = {isa = PBXBuildFile; fileRef = 66AE19DA1CC8CB3C00B78B5E /* tiger.svg */; };
B02E75F11C16104900D1971D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B02E75F01C16104900D1971D /* AppDelegate.swift */; };
B02E75F61C16104900D1971D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B02E75F41C16104900D1971D /* Main.storyboard */; };
@@ -47,6 +50,9 @@
575129B51CBD14AF00BD3C2E /* AnimationsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimationsView.swift; sourceTree = "<group>"; };
57AF398B1E67E9DB00F0BFE2 /* EventsExampleController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EventsExampleController.swift; sourceTree = "<group>"; };
58E4D50B1D841C6E00EC8815 /* TransformExampleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransformExampleView.swift; sourceTree = "<group>"; };
5B1AE0F720B58574007EECCB /* SVGExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SVGExampleViewController.swift; sourceTree = "<group>"; };
5B1AE0F820B58574007EECCB /* SVGViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SVGViewController.swift; sourceTree = "<group>"; };
5B1AE0FB20B5859E007EECCB /* shadows.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = shadows.svg; path = Example/Assets/SVG/shadows.svg; sourceTree = "<group>"; };
66AE19DA1CC8CB3C00B78B5E /* tiger.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = tiger.svg; path = Example/Assets/SVG/tiger.svg; sourceTree = "<group>"; };
B02E75ED1C16104900D1971D /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
B02E75F01C16104900D1971D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@@ -91,6 +97,7 @@
574EC4271CB7DE7F0063F317 /* Examples */ = {
isa = PBXGroup;
children = (
5B1AE0F620B58574007EECCB /* SVG */,
57AF398A1E67E86400F0BFE2 /* Events */,
5747F9BB1E38B660004E338F /* Morphing */,
6699B7CE1DFFE8B90072585E /* Transform */,
@@ -128,6 +135,15 @@
path = Events;
sourceTree = "<group>";
};
5B1AE0F620B58574007EECCB /* SVG */ = {
isa = PBXGroup;
children = (
5B1AE0F720B58574007EECCB /* SVGExampleViewController.swift */,
5B1AE0F820B58574007EECCB /* SVGViewController.swift */,
);
path = SVG;
sourceTree = "<group>";
};
65CBD13FE29C7F0265D0E051 /* Frameworks */ = {
isa = PBXGroup;
children = (
@@ -155,6 +171,7 @@
66AE19D91CC8CAB600B78B5E /* SVG */ = {
isa = PBXGroup;
children = (
5B1AE0FB20B5859E007EECCB /* shadows.svg */,
66AE19DA1CC8CB3C00B78B5E /* tiger.svg */,
);
name = SVG;
@@ -256,6 +273,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5B1AE0FC20B5859E007EECCB /* shadows.svg in Resources */,
B02E75FB1C16104900D1971D /* LaunchScreen.storyboard in Resources */,
B02E75F81C16104900D1971D /* Assets.xcassets in Resources */,
66AE19DB1CC8CB3C00B78B5E /* tiger.svg in Resources */,
@@ -333,6 +351,8 @@
B02E75F11C16104900D1971D /* AppDelegate.swift in Sources */,
57AF398C1E67E9DB00F0BFE2 /* EventsExampleController.swift in Sources */,
B04416FA1E041A420016BC50 /* EasingView.swift in Sources */,
5B1AE0F920B58575007EECCB /* SVGExampleViewController.swift in Sources */,
5B1AE0FA20B58575007EECCB /* SVGViewController.swift in Sources */,
574EC4411CB7E2440063F317 /* MenuViewController.swift in Sources */,
574EC43E1CB7DE7F0063F317 /* ShapesExampleView.swift in Sources */,
B04416FC1E04282A0016BC50 /* EasingExampleController.swift in Sources */,
51 changes: 51 additions & 0 deletions Example/Example/Assets/SVG/shadows.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 63 additions & 9 deletions Example/Example/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="pJi-Pa-uLB">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="pJi-Pa-uLB">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@@ -14,7 +15,7 @@
<objects>
<navigationController title="Main Navigation Controller" id="pJi-Pa-uLB" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="YMh-RQ-7Uo">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
@@ -158,10 +159,10 @@
</objects>
<point key="canvasLocation" x="-1551.2" y="1916.4917541229386"/>
</scene>
<!--SVG-->
<!--SVG Example-->
<scene sceneID="7mv-yr-foI">
<objects>
<viewController storyboardIdentifier="SVGExampleViewController" title="SVG" id="mKW-eb-P6k" sceneMemberID="viewController">
<viewController storyboardIdentifier="SVGExampleViewController" title="SVG Example" id="mKW-eb-P6k" customClass="SVGExampleViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="TsH-he-yyr"/>
<viewControllerLayoutGuide type="bottom" id="Ohj-O3-2uP"/>
@@ -173,9 +174,6 @@
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="yHP-DJ-SIl" customClass="SVGView" customModule="Macaw">
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="fileName" value="tiger"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -186,6 +184,9 @@
<constraint firstItem="yHP-DJ-SIl" firstAttribute="top" secondItem="TsH-he-yyr" secondAttribute="bottom" id="tzO-cY-rQ9"/>
</constraints>
</view>
<connections>
<outlet property="svgView" destination="yHP-DJ-SIl" id="JDo-NA-VIx"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="W3h-lx-w4E" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
@@ -238,7 +239,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7vb-6r-3PQ" customClass="MorphingView" customModule="Example" customModuleProvider="target">
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
<rect key="frame" x="0.0" y="128" width="375" height="539"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</subviews>
@@ -316,5 +317,58 @@
</objects>
<point key="canvasLocation" x="2006" y="470"/>
</scene>
<!--SVG-->
<scene sceneID="79Q-Jd-PMG">
<objects>
<viewController storyboardIdentifier="SVGViewController" title="SVG" automaticallyAdjustsScrollViewInsets="NO" id="uvA-T8-hbw" customClass="SVGViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="fig-Rp-T8Z"/>
<viewControllerLayoutGuide type="bottom" id="R8P-6y-Q4e"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="uKJ-4t-eHg">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="nXz-zM-57V">
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<view key="tableFooterView" contentMode="scaleToFill" id="blh-kp-V0S">
<rect key="frame" x="0.0" y="72" width="375" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="menu_cell" id="nqI-oj-oEY">
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="nqI-oj-oEY" id="iuZ-Mw-Fwi">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="uvA-T8-hbw" id="axt-M8-Xeg"/>
<outlet property="delegate" destination="uvA-T8-hbw" id="ybU-2C-kLl"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="nXz-zM-57V" firstAttribute="top" secondItem="fig-Rp-T8Z" secondAttribute="bottom" id="6kx-FJ-5rL"/>
<constraint firstItem="nXz-zM-57V" firstAttribute="leading" secondItem="uKJ-4t-eHg" secondAttribute="leading" id="Gja-K9-TGl"/>
<constraint firstAttribute="trailing" secondItem="nXz-zM-57V" secondAttribute="trailing" id="f8Z-Fh-Imv"/>
<constraint firstItem="R8P-6y-Q4e" firstAttribute="top" secondItem="nXz-zM-57V" secondAttribute="bottom" id="g7K-hq-BDw"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="Examples" id="7nX-3I-PDX"/>
<connections>
<outlet property="tableView" destination="nXz-zM-57V" id="sKg-c7-UXN"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="7hP-nz-SZf" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-81" y="1916"/>
</scene>
</scenes>
</document>
39 changes: 34 additions & 5 deletions Example/Example/Examples/SVG/SVGExampleViewController.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,39 @@
import UIKit
//
// SVGExampleViewController.swift
// Example
//
// Created by Alisa Mylnikova on 17/05/2018.
// Copyright © 2018 Exyte. All rights reserved.
//

import Macaw

class SVGExampleView: MacawView {
class SVGExampleViewController: UIViewController {

@IBOutlet var svgView: SVGView!

var fileName: String?

override func viewDidLoad() {
super.viewDidLoad()

svgView.fileName = fileName
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}


/*
// MARK: - Navigation

required init?(coder aDecoder: NSCoder) {
super.init(node: SVGParser.parse(path: "tiger"), coder: aDecoder)
}
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/

}
37 changes: 37 additions & 0 deletions Example/Example/Examples/SVG/SVGViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import UIKit

open class SVGViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {

@IBOutlet var tableView: UITableView!

fileprivate var svgExamples = [
"shadows",
"tiger"
]

open override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
tableView.reloadData()
}

open func numberOfSections(in tableView: UITableView) -> Int {
return 1
}

open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return svgExamples.count
}

open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "menu_cell")!
cell.textLabel?.text = svgExamples[indexPath.row].capitalized
return cell
}

open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let controller = UIStoryboard(name: "Main", bundle: .none).instantiateViewController(withIdentifier: "SVGExampleViewController") as! SVGExampleViewController
controller.fileName = svgExamples[indexPath.row]
navigationController?.pushViewController(controller, animated: true)
}

}
2 changes: 1 addition & 1 deletion Example/Example/MenuViewController.swift
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ open class MenuViewController: UIViewController, UITableViewDataSource, UITableV
"FirstPageViewController",
"TransformExampleController",
"AnimationsExampleController",
"SVGExampleViewController",
"SVGViewController",
"EasingExampleController",
"MorphingExampleController",
"EventsExampleController"
Loading

0 comments on commit 4907cc3

Please sign in to comment.