Compare commits

...

10 Commits

Author SHA1 Message Date
Rustam Moty 4738558207 Update README.md Add Desing 2024-09-19 05:30:33 +03:00
mrustaa ba36c06666 Merge commit '409f526cf64aa02d90b8efc8d2b0325d4def49bf' into ui_examples 2024-09-19 05:10:28 +03:00
mrustaa 41cc7c725a update ui_examples 2024-09-19 05:09:10 +03:00
Rustam Moty 409f526cf6 Update README.md 2024-09-19 05:08:04 +03:00
Rustam Moty b2b30b147f Update README.md 2024-09-04 18:10:35 +03:00
Rustam Moty a6b09007b2 Update README.md 2024-09-04 18:05:41 +03:00
Rustam Moty 7b001c292f Update README.md 2024-09-04 18:05:04 +03:00
Rustam Moty 5498067ffd Update README.md 2024-09-04 18:01:46 +03:00
Rustam Moty dce0be5a86 Update README.md 2024-09-04 17:59:41 +03:00
Rustam Moty 237bd57aca Update README.md 2024-09-04 10:30:09 +03:00
15 changed files with 1262 additions and 193 deletions
@@ -254,6 +254,12 @@
4A5247202C887C78009E629A /* CryptoDetailsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4A52471A2C887C78009E629A /* CryptoDetailsCell.xib */; };
4A5247212C887C78009E629A /* CryptoAmountCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A52471C2C887C78009E629A /* CryptoAmountCell.swift */; };
4A5247222C887C78009E629A /* CryptoAmountCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4A52471D2C887C78009E629A /* CryptoAmountCell.xib */; };
4A53F0AA2C88ECB500C4FE2E /* DesignnGraphViewLegacy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A53F0A92C88ECB500C4FE2E /* DesignnGraphViewLegacy.swift */; };
4A53F0AC2C88ECCE00C4FE2E /* DesignnGraphView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A53F0AB2C88ECCE00C4FE2E /* DesignnGraphView.swift */; };
4A847D932C88D659000DE0B9 /* DesignnShadowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A847D922C88D659000DE0B9 /* DesignnShadowView.swift */; };
4A847D952C88D682000DE0B9 /* DesignnView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A847D942C88D682000DE0B9 /* DesignnView.swift */; };
4A847D972C88D69E000DE0B9 /* DesignnGradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A847D962C88D69E000DE0B9 /* DesignnGradientView.swift */; };
4A847D992C88D6C2000DE0B9 /* DesignnImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A847D982C88D6C2000DE0B9 /* DesignnImageView.swift */; };
4A8ACA002C64EA390006B3D7 /* DesignFillView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A8AC9FF2C64EA390006B3D7 /* DesignFillView.swift */; };
4AB0D4EE2C82374D00903A73 /* ExampleAddCollectionViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4AB0D4C32C82374D00903A73 /* ExampleAddCollectionViewController.storyboard */; };
4AB0D4EF2C82374D00903A73 /* ExampleAddCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AB0D4C42C82374D00903A73 /* ExampleAddCollectionViewController.swift */; };
@@ -583,6 +589,12 @@
4A52471A2C887C78009E629A /* CryptoDetailsCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CryptoDetailsCell.xib; sourceTree = "<group>"; };
4A52471C2C887C78009E629A /* CryptoAmountCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CryptoAmountCell.swift; sourceTree = "<group>"; };
4A52471D2C887C78009E629A /* CryptoAmountCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CryptoAmountCell.xib; sourceTree = "<group>"; };
4A53F0A92C88ECB500C4FE2E /* DesignnGraphViewLegacy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DesignnGraphViewLegacy.swift; sourceTree = "<group>"; };
4A53F0AB2C88ECCE00C4FE2E /* DesignnGraphView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DesignnGraphView.swift; sourceTree = "<group>"; };
4A847D922C88D659000DE0B9 /* DesignnShadowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DesignnShadowView.swift; sourceTree = "<group>"; };
4A847D942C88D682000DE0B9 /* DesignnView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DesignnView.swift; sourceTree = "<group>"; };
4A847D962C88D69E000DE0B9 /* DesignnGradientView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DesignnGradientView.swift; sourceTree = "<group>"; };
4A847D982C88D6C2000DE0B9 /* DesignnImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DesignnImageView.swift; sourceTree = "<group>"; };
4A8AC9FF2C64EA390006B3D7 /* DesignFillView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DesignFillView.swift; sourceTree = "<group>"; };
4AB0D4C32C82374D00903A73 /* ExampleAddCollectionViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = ExampleAddCollectionViewController.storyboard; sourceTree = "<group>"; };
4AB0D4C42C82374D00903A73 /* ExampleAddCollectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExampleAddCollectionViewController.swift; sourceTree = "<group>"; };
@@ -2136,6 +2148,19 @@
path = CryptoAmountCell;
sourceTree = "<group>";
};
4A847D9A2C88D6DE000DE0B9 /* Designn */ = {
isa = PBXGroup;
children = (
4A847D922C88D659000DE0B9 /* DesignnShadowView.swift */,
4A847D942C88D682000DE0B9 /* DesignnView.swift */,
4A847D962C88D69E000DE0B9 /* DesignnGradientView.swift */,
4A53F0A92C88ECB500C4FE2E /* DesignnGraphViewLegacy.swift */,
4A53F0AB2C88ECCE00C4FE2E /* DesignnGraphView.swift */,
4A847D982C88D6C2000DE0B9 /* DesignnImageView.swift */,
);
path = Designn;
sourceTree = "<group>";
};
4AB0D4C52C82374D00903A73 /* ExampleAddCollectionView */ = {
isa = PBXGroup;
children = (
@@ -2351,6 +2376,7 @@
isa = PBXGroup;
children = (
4AB6DDFC2C3BEE46004A8866 /* Еxtentions */,
4A847D9A2C88D6DE000DE0B9 /* Designn */,
4AB6DDFD2C3BEE46004A8866 /* CopyableLabel.swift */,
4AB6DDFE2C3BEE46004A8866 /* DesignButton.swift */,
4AB6DDFF2C3BEE46004A8866 /* DesignFigure.swift */,
@@ -2768,6 +2794,7 @@
4A0FBAB42C825CD6000A06CF /* TaxiRateEmojiCell.swift in Sources */,
4A52471F2C887C78009E629A /* CryptoDetailsCell.swift in Sources */,
4A0FBA6E2C825CD6000A06CF /* PlayMusicItCell.swift in Sources */,
4A847D932C88D659000DE0B9 /* DesignnShadowView.swift in Sources */,
46ACF05D2490F52600FAAD43 /* LocalizationManager.swift in Sources */,
4A0FBA2E2C825CD6000A06CF /* MyCardsTitileCell.swift in Sources */,
4AB0D5082C82374E00903A73 /* ExamplesSettingsViewController.swift in Sources */,
@@ -2785,6 +2812,7 @@
4A0FBA3E2C825CD6000A06CF /* CustomCardHeaderView.swift in Sources */,
46ACF0952490F52600FAAD43 /* LocationContainerController.swift in Sources */,
4A0FBA5A2C825CD6000A06CF /* MapParkingMiniCell.swift in Sources */,
4A847D972C88D69E000DE0B9 /* DesignnGradientView.swift in Sources */,
4AB0D4FF2C82374E00903A73 /* ExampleCellStyle.swift in Sources */,
4AB0D4F42C82374D00903A73 /* ExamplesContainerControllerScrollType.swift in Sources */,
4AB6DE412C3BF2F2004A8866 /* Device.swift in Sources */,
@@ -2817,8 +2845,10 @@
46ACF0552490F52600FAAD43 /* Colors.swift in Sources */,
4AB0D4F12C82374D00903A73 /* ExampleAddTableViewController.swift in Sources */,
4A0FBA542C825CD6000A06CF /* ImagineSmallTagCell.swift in Sources */,
4A847D992C88D6C2000DE0B9 /* DesignnImageView.swift in Sources */,
4A0FBA6C2C825CD6000A06CF /* PlayMusicCatalogCell.swift in Sources */,
4AB0D4F52C82374E00903A73 /* ExamplesScrollViews.swift in Sources */,
4A53F0AA2C88ECB500C4FE2E /* DesignnGraphViewLegacy.swift in Sources */,
4AB6DE212C3BEE46004A8866 /* DesignButton.swift in Sources */,
4A0FBA902C825CD6000A06CF /* SportCatalogOneCell.swift in Sources */,
46ACF0692490F52600FAAD43 /* MapsSectionCell.swift in Sources */,
@@ -2842,6 +2872,7 @@
46ACF06E2490F52600FAAD43 /* LocationAddressCell.swift in Sources */,
4A0FBA2A2C825CD6000A06CF /* MyCardsCollectionCell.swift in Sources */,
4A0FBA322C825CD6000A06CF /* CryptoOneCell.swift in Sources */,
4A53F0AC2C88ECCE00C4FE2E /* DesignnGraphView.swift in Sources */,
46ACF0572490F52600FAAD43 /* StoryboardController.swift in Sources */,
4A0FBA462C825CD6000A06CF /* ImagineCollectionCell.swift in Sources */,
46ACF0842490F52600FAAD43 /* HeaderTabBarView.swift in Sources */,
@@ -2882,6 +2913,7 @@
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
4A0FBA372C825CD6000A06CF /* CryptoViewController.swift in Sources */,
4AB6DE252C3BEE46004A8866 /* DesignLabel.swift in Sources */,
4A847D952C88D682000DE0B9 /* DesignnView.swift in Sources */,
4A0FBA862C825CD6000A06CF /* TimerUtils.swift in Sources */,
4AB0D5022C82374E00903A73 /* ExampleFooterButtonView.swift in Sources */,
4A0FBA8C2C825CD6000A06CF /* SportCatalogCell.swift in Sources */,
@@ -38,7 +38,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="132" y="137.18140929535232"/>
<point key="canvasLocation" x="132" y="136.69950738916256"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="jWl-Kd-Y9J">
@@ -62,7 +62,7 @@
</scenes>
<resources>
<systemColor name="secondaryLabelColor">
<color red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -9,195 +9,9 @@
import UIKit
@IBDesignable
class DesignnImageView: UIView {
@IBInspectable var cornerRadius: CGFloat = 0.0
@IBInspectable var fillColor: UIColor?
@IBInspectable var image: UIImage?
@IBInspectable var imageMode: Int = 1
@IBInspectable var blur: CGFloat = 0.0
@IBInspectable var brColor: UIColor = .clear
@IBInspectable var brWidth: CGFloat = 0.0
@IBInspectable var brDash: Int = 0
func setup() {
if let foundView = viewWithTag(55) {
foundView.removeFromSuperview()
}
let d = DesignFigure_(frame: bounds)
d.backgroundColor = .clear
d.tag = 55
d.cornerRadius = cornerRadius
d.blur = blur
d.image = image
d.imageMode = imageMode
d.fillColor = fillColor
d.brWidth = brWidth
d.brColor = brColor
d.brDash = brDash
insertSubview(d, at: 0)
}
override func layoutSubviews() { setup() }
}
@IBDesignable
class DesignnGradientView: UIView {
@IBInspectable var cornerRadius: CGFloat = 0.0
@IBInspectable var fillColor: UIColor?
@IBInspectable var brColor: UIColor = .clear
@IBInspectable var brWidth: CGFloat = 0.0
@IBInspectable var brDash: Int = 0
@IBInspectable var grColor1: UIColor?
@IBInspectable var grColor2: UIColor?
@IBInspectable var grColor3: UIColor?
@IBInspectable var grStartPoint: CGPoint = .zero
@IBInspectable var grEndPoint: CGPoint = .zero
@IBInspectable var grRadial: Bool = false /// default: linear
func setup() {
if let foundView = viewWithTag(55) {
foundView.removeFromSuperview()
}
let d = DesignFigure_(frame: bounds)
d.backgroundColor = .clear
d.tag = 55
d.cornerRadius = cornerRadius
// d.blur = blur
// d.image = image
// d.imageMode = imageMode
d.fillColor = fillColor
d.brWidth = brWidth
d.brColor = brColor
d.brDash = brDash
d.grColor1 = grColor1
d.grColor2 = grColor2
d.grColor3 = grColor3
// d.grColor4 = grColor4
// d.grColor5 = grColor5
// d.grColor6 = grColor6
d.grStartPoint = grStartPoint
d.grEndPoint = grEndPoint
d.grRadial = grRadial
// d.grDrawsOptions = grDrawsOptions
// d.grDebug = grDebug
// d.grPointPercent = grPointPercent
// d.grBlendMode = grBlendMode
insertSubview(d, at: 0)
}
override func layoutSubviews() { setup() }
}
@IBDesignable
class DesignnShadowView: UIView {
@IBInspectable var cornerRadius: CGFloat = 0.0
@IBInspectable var fillColor: UIColor?
@IBInspectable var brColor: UIColor = .clear
@IBInspectable var brWidth: CGFloat = 0.0
@IBInspectable var brDash: Int = 0
@IBInspectable var shColor: UIColor = .clear
@IBInspectable var shRadius: CGFloat = 0.0
@IBInspectable var shOffset: CGSize = .zero
func setup() {
if let foundView = viewWithTag(55) {
foundView.removeFromSuperview()
}
let d = DesignFigure_(frame: bounds)
d.backgroundColor = .clear
d.tag = 55
d.cornerRadius = cornerRadius
// d.blur = blur
// d.image = image
// d.imageMode = imageMode
d.fillColor = fillColor
d.brWidth = brWidth
d.brColor = brColor
d.brDash = brDash
d.shColor = shColor
d.shRadius = shRadius
d.shOffset = shOffset
insertSubview(d, at: 0)
}
override func layoutSubviews() { setup() }
}
@IBDesignable
class DesignnView: UIView {
@IBInspectable var cornerRadius: CGFloat = 0.0
@IBInspectable var fillColor: UIColor?
@IBInspectable var brColor: UIColor = .clear
@IBInspectable var brWidth: CGFloat = 0.0
@IBInspectable var brDash: Int = 0
func setup() {
if let foundView = viewWithTag(55) {
foundView.removeFromSuperview()
}
let d = DesignFigure_(frame: bounds)
d.backgroundColor = .clear
d.tag = 55
d.cornerRadius = cornerRadius
// d.blur = blur
// d.image = image
// d.imageMode = imageMode
d.fillColor = fillColor
d.brWidth = brWidth
d.brColor = brColor
d.brDash = brDash
insertSubview(d, at: 0)
}
override func layoutSubviews() { setup() }
}
@IBDesignable
class DesignFillView_: UIView {
@@ -0,0 +1,71 @@
//
// DesignnGradientView.swift
// ContainerControllerSwift_Example
//
// Created by Рустам Мотыгуллин on 04.09.2024.
// Copyright © 2024 CocoaPods. All rights reserved.
//
import UIKit
@IBDesignable
class DesignnGradientView: UIView {
@IBInspectable var cornerRadius: CGFloat = 0.0
@IBInspectable var fillColor: UIColor?
@IBInspectable var brColor: UIColor = .clear
@IBInspectable var brWidth: CGFloat = 0.0
@IBInspectable var brDash: Int = 0
@IBInspectable var grColor1: UIColor?
@IBInspectable var grColor2: UIColor?
@IBInspectable var grColor3: UIColor?
@IBInspectable var grStartPoint: CGPoint = .zero
@IBInspectable var grEndPoint: CGPoint = .zero
@IBInspectable var grRadial: Bool = false /// default: linear
func setup() {
if let foundView = viewWithTag(55) {
foundView.removeFromSuperview()
}
let d = DesignFigure_(frame: bounds)
d.backgroundColor = .clear
d.tag = 55
d.cornerRadius = cornerRadius
// d.blur = blur
// d.image = image
// d.imageMode = imageMode
d.fillColor = fillColor
d.brWidth = brWidth
d.brColor = brColor
d.brDash = brDash
d.grColor1 = grColor1
d.grColor2 = grColor2
d.grColor3 = grColor3
// d.grColor4 = grColor4
// d.grColor5 = grColor5
// d.grColor6 = grColor6
d.grStartPoint = grStartPoint
d.grEndPoint = grEndPoint
d.grRadial = grRadial
// d.grDrawsOptions = grDrawsOptions
// d.grDebug = grDebug
// d.grPointPercent = grPointPercent
// d.grBlendMode = grBlendMode
insertSubview(d, at: 0)
}
override func layoutSubviews() { setup() }
}
@@ -0,0 +1,674 @@
//
// DesignnGraphView.swift
// ContainerControllerSwift_Example
//
// Created by Рустам Мотыгуллин on 04.09.2024.
// Copyright © 2024 CocoaPods. All rights reserved.
//
import UIKit
@IBDesignable
class DesignnGraphView: UIView {
@IBInspectable var gr2Color1: UIColor?
@IBInspectable var gr2Color2: UIColor?
@IBInspectable var gr2Color3: UIColor?
@IBInspectable var gr2StartPoint: CGPoint = .zero
@IBInspectable var gr2EndPoint: CGPoint = .zero
@IBInspectable var gr2BlendMode: Int = 0
@IBInspectable var grColor1: UIColor?
@IBInspectable var grColor2: UIColor?
@IBInspectable var grColor3: UIColor?
@IBInspectable var grStartPoint: CGPoint = .zero
@IBInspectable var grEndPoint: CGPoint = .zero
@IBInspectable var grRadial: Bool = false /// default: linear
@IBInspectable var grBlendMode: Int = 0
@IBInspectable var fillColor: UIColor?
@IBInspectable var padding: CGFloat = 0
@IBInspectable var cornerRadius: CGFloat = 0.0
@IBInspectable var brColor: UIColor = .clear
@IBInspectable var brWidth: CGFloat = 0.0
@IBInspectable var addPoints: Bool = true
@IBInspectable var arrStr: String = ""
var data: [CGFloat] {
get {
let result = arrStr.components(separatedBy: ",")
let newResult = result.map {
CGFloat(Int($0) ?? 0)
}
return newResult
}
set {
setNeedsDisplay()
}
}
override func layoutSubviews() { setup() }
func setup() {
self.layer.backgroundColor = UIColor.clear.cgColor
self.backgroundColor = UIColor.clear
self.layer.cornerRadius = cornerRadius
// self.cornerRadius = cornerRadius
self.clipsToBounds = true
let bezier = rectanglee(rect: bounds, radius: cornerRadius)
addFill(bezier: bezier, fillColor: fillColor)
// guard let context = UIGraphicsGetCurrentContext() else { return }
let curve = quadCurvedPath()
let path = curve.0
let points = curve.1
addGradient(
bezier: path,
grColor1: gr2Color1,
grColor2: gr2Color2,
grColor3: gr2Color3,
grStartPoint: gr2StartPoint,
grEndPoint: gr2EndPoint,
grBlendMode: gr2BlendMode
)
// context.saveGState()
// path.addClip()
// context.drawLinearGradient(gradient,
// start: grStartPointR,
// end: grEndPointR,
// options: options)
// brColor.setStroke()
// path.lineWidth = brWidth
// path.stroke()
gradientCurve(points: points)
// addInfoLabels()
// addGradient(bezier: bezier)
// if let foundView = viewWithTag(55) {
// foundView.removeFromSuperview()
// }
//
//
// let d = DesignnGradientView(frame: bounds)
// d.backgroundColor = .clear
// d.tag = 44
// d.fillColor = .clear
// d.brWidth = brWidth
// d.brColor = brColor
// d.grColor1 = grColor1
// d.grColor2 = grColor2
// d.grColor3 = grColor3
// d.grStartPoint = grStartPoint
// d.grEndPoint = grEndPoint
// d.layoutSubviews()
//
//
// let g = DesignnGraphOnlyView(frame: bounds)
// g.backgroundColor = .clear
// g.tag = 44
// g.fillColor = .clear
// g.brWidth = brWidth
// g.brColor = brColor
// g.arrStr = arrStr
// g.layoutSubviews()
// let path = quadCurvedPath()
// brColor.setStroke()
// path.lineWidth = brWidth
// path.stroke()
// var colors: [CGColor] = []
// if let c = grColor1 { colors.append(c.cgColor) }
// if let c = grColor2 { colors.append(c.cgColor) }
// if let c = grColor3 { colors.append(c.cgColor) }
//
// let gradient = CAGradientLayer()
// gradient.frame = path.bounds
// gradient.colors = colors
//
// let shapeMask = CAShapeLayer()
// shapeMask.path = path.cgPath
//
// gradient.mask = shapeMask
// self.layer.addSublayer(gradient)
// let newPath = convert(path, from: self)
// UIColor.orange.setFill()
// newPath.fill()
}
func gradientCurve(points: [CGPoint]) {
// Gradient for the chart colors
let gradient = CAGradientLayer()
var colors: [CGColor] = []
if let c = grColor1 { colors.append(c.cgColor) }
if let c = grColor2 { colors.append(c.cgColor) }
if let c = grColor3 { colors.append(c.cgColor) }
gradient.colors = colors
gradient.startPoint = grEndPoint
gradient.endPoint = grStartPoint
gradient.frame = bounds
layer.addSublayer(gradient)
// Random points
let graph = CAShapeLayer()
let path = CGMutablePath()
// var y: CGFloat = 150
// let points: [CGPoint] = stride(from: CGFloat.zero, to: 300, by: 2).map {
// let change = CGFloat.random(in: -20...20)
// var newY = y + change
// newY = max(10, newY)
// newY = min(newY, 300)
// y = newY
// return CGPoint(x: $0, y: y)
// }
path.addLines(between: points)
graph.path = path
graph.fillColor = nil
graph.strokeColor = UIColor.black.cgColor
graph.lineWidth = brWidth
graph.lineJoin = .round
graph.lineCap = .round
graph.frame = bounds
// Only show the gradient where the line is
gradient.mask = graph
}
func convert(_ path: UIBezierPath, from view: UIView) -> UIBezierPath {
path.apply(view.transform)
// we now have a path in view's superview's coordinates. Let's adjust by the origin.
let viewTransform = CGAffineTransform(translationX: view.frame.origin.x, y: view.frame.origin.y)
path.apply(viewTransform)
// now the path is adjusted by view's origin. Next we need to subtract self's origin
let selfTranslationTransform = CGAffineTransform(translationX: -self.frame.origin.x, y: -self.frame.origin.y)
path.apply(selfTranslationTransform)
// now adjust by self's transform
path.apply(self.transform.inverted())
return path
}
override func draw(_ rect: CGRect) {
setup()
// self.layer.cornerRadius = cornerRadius
// self.layer.backgroundColor = fillColor?.cgColor
// self.clipsToBounds = true
//
//
// let bezier = rectangle(rect: bounds, radius: cornerRadius)
//
//// addFill(bezier: bezier)
////
//// addGradient(bezier: bezier)
//
//
// let path = quadCurvedPath()
//
//
// var colors: [CGColor] = []
// if let c = grColor1 { colors.append(c.cgColor) }
// if let c = grColor2 { colors.append(c.cgColor) }
// if let c = grColor3 { colors.append(c.cgColor) }
//
// let gradient = CAGradientLayer()
// gradient.frame = path.bounds
// gradient.colors = colors
//
// let shapeMask = CAShapeLayer()
// shapeMask.path = path.cgPath
//
// gradient.mask = shapeMask
// self.layer.addSublayer(gradient)
// brColor.setStroke()
// path.lineWidth = brWidth
// path.stroke()
}
func getText(_ text: String, size: CGFloat = 12, position: CGPoint) -> CATextLayer {
let textlayer = CATextLayer()
textlayer.frame = CGRect(x: position.x, y: position.y, width: 30, height: 18)
textlayer.fontSize = size
textlayer.alignmentMode = .center
textlayer.string = text
textlayer.isWrapped = true
textlayer.truncationMode = .end
textlayer.backgroundColor = UIColor.clear.cgColor
textlayer.foregroundColor = UIColor.black.cgColor
return textlayer
}
func getRect() -> CGSize {
.init(width: bounds.width - (padding * 2), height: bounds.height - (padding * 2))
}
func quadCurvedPath() -> (UIBezierPath, [CGPoint]) {
var arrPoints: [CGPoint] = []
let path = UIBezierPath()
let step = (getRect().width) / CGFloat(data.count - 1)
var p1 = CGPoint(x: 0 + padding, y: coordYFor(index: 0) + padding)
arrPoints.append(p1)
path.move(to: p1)
if addPoints { drawPoint(point: p1, color: UIColor.red, radius: 3) }
if (data.count == 2) {
let pp = CGPoint(x: step + padding, y: coordYFor(index: 1) + padding)
arrPoints.append(pp)
path.addLine(to: pp)
return (path, arrPoints)
}
var oldControlP: CGPoint?
for i in 1..<data.count {
let p2 = CGPoint(x: (step * CGFloat(i)) + padding, y: coordYFor(index: i) + padding)
if addPoints { drawPoint(point: p2, color: UIColor.red, radius: 3) }
var p3: CGPoint?
if i < data.count - 1 {
p3 = CGPoint(x: (step * CGFloat(i + 1)) + padding, y: (coordYFor(index: i + 1)) + padding)
}
let newControlP = controlPointForPoints(p1: p1, p2: p2, next: p3)
arrPoints.append(p2)
path.addCurve(to: p2, controlPoint1: oldControlP ?? p1, controlPoint2: newControlP ?? p2)
p1 = p2
oldControlP = antipodalFor(point: newControlP, center: p2)
}
path.addLine(to: .init(x: getRect().width, y: getRect().height))
path.addLine(to: .init(x: 0, y: getRect().height))
if arrPoints.count > 0 {
path.addLine(to: arrPoints[0])
}
// path.close()
// arrPoints.reverse()
//
// var old: CGPoint = oldControlP ?? p1
// arrPoints.forEach {
// let new: CGPoint = .init(x: $0.x + 0.5, y: $0.y + 0.5)
// path.addCurve(to: new, controlPoint1: old, controlPoint2: new)
// old = new
// }
return (path, arrPoints);
}
/// located on the opposite side from the center point
func antipodalFor(point: CGPoint?, center: CGPoint?) -> CGPoint? {
guard let p1 = point, let center = center else {
return nil
}
let newX = 2 * center.x - p1.x
let diffY = abs(p1.y - center.y)
let newY = center.y + diffY * (p1.y < center.y ? 1 : -1)
return CGPoint(x: newX, y: newY)
}
/// halfway of two points
func midPointForPoints(p1: CGPoint, p2: CGPoint) -> CGPoint {
return CGPoint(x: (p1.x + p2.x) / 2, y: (p1.y + p2.y) / 2);
}
/// Find controlPoint2 for addCurve
/// - Parameters:
/// - p1: first point of curve
/// - p2: second point of curve whose control point we are looking for
/// - next: predicted next point which will use antipodal control point for finded
func controlPointForPoints(p1: CGPoint, p2: CGPoint, next p3: CGPoint?) -> CGPoint? {
guard let p3 = p3 else {
return nil
}
let leftMidPoint = midPointForPoints(p1: p1, p2: p2)
let rightMidPoint = midPointForPoints(p1: p2, p2: p3)
var controlPoint = midPointForPoints(p1: leftMidPoint, p2: antipodalFor(point: rightMidPoint, center: p2)!)
if p1.y.between(a: p2.y, b: controlPoint.y) {
controlPoint.y = p1.y
} else if p2.y.between(a: p1.y, b: controlPoint.y) {
controlPoint.y = p2.y
}
let imaginContol = antipodalFor(point: controlPoint, center: p2)!
if p2.y.between(a: p3.y, b: imaginContol.y) {
controlPoint.y = p2.y
}
if p3.y.between(a: p2.y, b: imaginContol.y) {
let diffY = abs(p2.y - p3.y)
controlPoint.y = p2.y + diffY * (p3.y < p2.y ? 1 : -1)
}
// make lines easier
controlPoint.x += (p2.x - p1.x) * 0.1
return controlPoint
}
func coordYFor(index: Int) -> CGFloat {
return getRect().height - getRect().height * data[index] / (data.max() ?? 0)
}
func drawPoint(point: CGPoint, color: UIColor, radius: CGFloat) {
let ovalPath = UIBezierPath(ovalIn: CGRect(x: point.x - radius, y: point.y - radius, width: radius * 2, height: radius * 2))
color.setFill()
ovalPath.fill()
}
}
extension CGFloat {
func between(a: CGFloat, b: CGFloat) -> Bool {
return self >= Swift.min(a, b) && self <= Swift.max(a, b)
}
}
extension UIView {
func rectanglee(rect: CGRect, radius: CGFloat) -> UIBezierPath {
let r = self.cornerRadius(radius)
let w = rect.width
let h = rect.height
let path = UIBezierPath()
path.move(to: CGPoint(x: r, y: 0.0))
path.addLine(to: CGPoint(x: w - r, y: 0.0))
path.addArc(withCenter: CGPoint(x: w - r, y: r),
radius: r,
startAngle: 3.0 * .pi / 2.0,
endAngle: 2 * .pi,
clockwise: true)
path.addLine(to: CGPoint(x: w, y: h - r))
path.addArc(withCenter: CGPoint(x: w - r, y: h - r),
radius: r,
startAngle: 0.0,
endAngle: .pi / 2.0,
clockwise: true)
path.addLine(to: CGPoint(x: r, y: h))
path.addArc(withCenter: CGPoint(x: r, y: h - r),
radius: r,
startAngle: .pi / 2.0,
endAngle: .pi,
clockwise: true)
path.addLine(to: CGPoint(x: 0.0, y: r))
path.addArc(withCenter: CGPoint(x: r, y: r),
radius: r,
startAngle: .pi,
endAngle: 3.0 * .pi / 2.0,
clockwise: true)
path.close()
return path
}
func drawLinearGradient(inside path:UIBezierPath, start:CGPoint, end:CGPoint, colors:[UIColor])
{
guard let ctx = UIGraphicsGetCurrentContext() else { return }
ctx.saveGState()
defer { ctx.restoreGState() } // clean up graphics state changes when the method returns
path.addClip() // use the path as the clipping region
let cgColors = colors.map({ $0.cgColor })
guard let gradient = CGGradient(colorsSpace: nil, colors: cgColors as CFArray, locations: nil)
else { return }
ctx.drawLinearGradient(gradient, start: start, end: end, options: [])
}
}
extension DesignnGraphView {
//MARK: - Gradient
private func addGradient(
bezier: UIBezierPath,
grColor1: UIColor?,
grColor2: UIColor?,
grColor3: UIColor?,
grStartPoint: CGPoint,
grEndPoint: CGPoint,
grBlendMode: Int = 0
) {
guard let context = UIGraphicsGetCurrentContext() else { return }
var colors: [CGColor] = []
if let c = grColor1 { colors.append(c.cgColor) }
if let c = grColor2 { colors.append(c.cgColor) }
if let c = grColor3 { colors.append(c.cgColor) }
// if let c = grColor4 { colors.append(c.cgColor) }
// if let c = grColor5 { colors.append(c.cgColor) }
// if let c = grColor6 { colors.append(c.cgColor) }
if colors.count < 2 {
colors.append(UIColor.clear.cgColor)
colors.append(UIColor.clear.cgColor)
} else if colors.count < 1 {
if grColor1 != nil {
colors.append(UIColor.clear.cgColor)
} else {
colors.insert(UIColor.clear.cgColor, at: 0)
}
}
guard let gradient = CGGradient(colorsSpace: nil,
colors: colors as CFArray,
locations: nil) else { return }
let grDrawsOptions: Bool = true
let grPointPercent: Bool = true
let bMode = CGBlendMode(rawValue: CGBlendMode.RawValue(grBlendMode)) ?? CGBlendMode.sourceAtop
// bMode = CGBlendMode.screen
context.setBlendMode(bMode)
let options: CGGradientDrawingOptions =
grDrawsOptions ? [ .drawsBeforeStartLocation, .drawsAfterEndLocation ] : [ ]
var grEndPointR: CGPoint = grEndPoint
var grStartPointR: CGPoint = grStartPoint
if grPointPercent {
grEndPointR = CGPoint(x: (grEndPoint.x * frame.width), y: (grEndPoint.y * frame.height))
grStartPointR = CGPoint(x: (grStartPoint.x * frame.width), y: (grStartPoint.y * frame.height))
}
bezier.close()
context.saveGState()
bezier.addClip()
if grRadial {
let x: CGFloat = (grEndPointR.x - grStartPointR.x)
let y: CGFloat = (grEndPointR.y - grStartPointR.y)
let distance: CGFloat = sqrt((x * x) + (y * y))
context.drawRadialGradient(gradient,
startCenter: grStartPointR,
startRadius: 0,
endCenter: grStartPointR,
endRadius: distance,
options: options)
} else {
context.drawLinearGradient(gradient,
start: grStartPointR,
end: grEndPointR,
options: options)
}
}
}
extension DesignnGraphView {
func addInfoLabels() {
let mmaax = Int(data.max() ?? 0)
self.layer.addSublayer(getText("0" ,size: 13, position: .init(x: 0, y: bounds.height - 18 )))
self.layer.addSublayer(getText("\(mmaax)" ,size: 13, position: .init(x: 0, y: 0 )))
self.layer.addSublayer(getText("\(data.count)" ,size: 13, position: .init(x: bounds.width - 30, y: bounds.height - 18 )))
var start = false
var half = false
var end = false
for i in 0..<mmaax {
let y = (( CGFloat(i) / CGFloat(mmaax) ) * (bounds.height - 18))
let percent = Int((y / bounds.height) * 100)
var str = "\(100 - percent )%"
str = "--"
if percent >= 25 && !start {
start = true
self.layer.addSublayer(getText( str ,size: 10, position: .init(x: 0 , y: y - 9 )))
self.layer.addSublayer(getText( str ,size: 10, position: .init(x: bounds.width - 30 , y: y - 9 )))
}
if percent >= 50 && !half {
half = true
str = "=--"
self.layer.addSublayer(getText(str,size: 10, position: .init(x: 0 , y: y - 9 )))
str = "--="
self.layer.addSublayer(getText( str ,size: 10, position: .init(x: bounds.width - 30 , y: y - 9 )))
}
if percent >= 75 && !end {
end = true
self.layer.addSublayer(getText(str,size: 10, position: .init(x:0, y:y - 9)))
self.layer.addSublayer(getText( str ,size: 10, position: .init(x: bounds.width - 30 , y: y - 9 )))
}
}
start = false
half = false
end = false
for i in 0..<data.count {
let x = (( CGFloat(i) / CGFloat(data.count) ) * (bounds.width - 30))
let percent = Int((x / bounds.width) * 100)
var str = "\(percent)%"
str = "!"
if percent >= 25 && !start {
start = true
self.layer.addSublayer(getText(str,size: 10, position: .init(x: x - 15 , y: bounds.height - 18 )))
self.layer.addSublayer(getText(str,size: 10, position: .init(x: x - 15 , y: 5 )))
}
if percent >= 50 && !half {
half = true
str = ".|."
self.layer.addSublayer(getText(str,size: 10, position: .init(x: x - 15 , y: bounds.height - 18 )))
str = "'|'"
self.layer.addSublayer(getText(str,size: 10, position: .init(x: x - 15 , y: 5 )))
}
if percent >= 75 && !end {
end = true
self.layer.addSublayer(getText(str,size: 10, position: .init(x: x - 15, y: bounds.height - 18 )))
self.layer.addSublayer(getText(str,size: 10, position: .init(x: x - 15 , y: 5 )))
}
}
}
}
extension UIView {
func addFill(bezier: UIBezierPath, fillColor: UIColor?) {
guard let fillColor = fillColor else { return }
guard let context = UIGraphicsGetCurrentContext() else { return }
bezier.close()
context.saveGState()
fillColor.setFill()
bezier.fill()
context.restoreGState()
}
}
@@ -0,0 +1,193 @@
//
// DesignnGraphViewLegacy.swift
// ContainerControllerSwift_Example
//
// Created by Рустам Мотыгуллин on 04.09.2024.
// Copyright © 2024 CocoaPods. All rights reserved.
//
import UIKit
@IBDesignable
class DesignnGraphViewOld: UIView {
@IBInspectable var maxValue: Int = 100
@IBInspectable var minValue: Int = 0
@IBInspectable var padding: Int = 10
@IBInspectable var arrStr: String = ""
var arrData: [Int] = [10,5,50,70,80,40,35,55,60,62,20,40,70,60,50,90,95]
@IBInspectable var cornerRadius: CGFloat = 0.0
@IBInspectable var fillColor: UIColor?
@IBInspectable var brColor: UIColor = .clear
@IBInspectable var brWidth: CGFloat = 0.0
@IBInspectable var brDash: Int = 0
func addFill(bezier: UIBezierPath) {
guard let fillColor = fillColor else { return }
guard let context = UIGraphicsGetCurrentContext() else { return }
bezier.close()
context.saveGState()
fillColor.setFill()
bezier.fill()
context.restoreGState()
}
override func draw(_ rect: CGRect) {
super.draw(rect)
// layer.backgroundColor = fillColor?.cgColor
let context = UIGraphicsGetCurrentContext()!
let oval = UIBezierPath(ovalIn: rect)
addFill(bezier: oval)
UIColor.green.setStroke()
oval.lineWidth = 2 * 2
oval.stroke()
//// Color Declarations
let gradientColor = UIColor(red: 0.039, green: 0.839, blue: 0.361, alpha: 0.140)
let gradientColor2 = UIColor(red: 0.039, green: 0.841, blue: 0.362, alpha: 0.000)
let gradientColor3 = UIColor.green
let color = UIColor.red
//// Gradient Declarations
// let gradient = CGGradient(colorsSpace: nil, colors: [ gradientColor.cgColor, gradientColor2.cgColor] as CFArray, locations: [0, 1])!
//// Rectangle Drawing
// let rectanglePath = UIBezierPath(rect: CGRect(x: 0, y: 0, width: 70, height: 70))
// color.setFill()
// rectanglePath.fill()
//// Bezier Drawing
let bezierPath = UIBezierPath ()
UIColor.green.setStroke()
bezierPath.lineWidth = 2 * 2
// let result = arrStr.components(separatedBy: ",")
//
// let newResult = result.map {
// Int($0) ?? 0
// }
arrData.enumerated().forEach { index, item in
let widht = ( (rect.width) - ( CGFloat(padding) * 2))
let height = ( (rect.height) - (CGFloat(padding) * 2))
let y = ((( CGFloat(index) / CGFloat(arrData.count) ) * widht) + CGFloat(padding))
let maxHeight = CGFloat(arrData.max() ?? 0)
let x = ((( CGFloat(item) / maxHeight) * height) + CGFloat(padding))
bezierPath.move(to: CGPoint(x: x, y: y))
}
// bezierPath.move(to: CGPoint(x: 4, y: 34.64))
// bezierPath.addLine(to: CGPoint(x: 8.4, y: 34.64))
// bezierPath.addLine(to: CGPoint(x: 11.04, y: 32.04))
// bezierPath.addLine(to: CGPoint(x: 15.44, y: 32.04))
// bezierPath.addLine(to: CGPoint(x: 18.53, y: 29.01))
// bezierPath.addLine(to: CGPoint(x: 22.49, y: 29.01))
// bezierPath.addLine(to: CGPoint(x: 26.01, y: 34.64))
// bezierPath.addLine(to: CGPoint(x: 29.53, y: 37.89))
// bezierPath.addLine(to: CGPoint(x: 32.61, y: 37.89))
// bezierPath.addLine(to: CGPoint(x: 34.81, y: 34.64))
// bezierPath.addLine(to: CGPoint(x: 38.55, y: 34.64))
// bezierPath.addLine(to: CGPoint(x: 42.95, y: 25.55))
// bezierPath.addLine(to: CGPoint(x: 53.08, y: 25.55))
// bezierPath.addLine(to: CGPoint(x: 55.5, y: 21))
// bezierPath.addLine(to: CGPoint(x: 61, y: 21))
// bezierPath.addLine(to: CGPoint(x: 61, y: 42))
// bezierPath.addLine(to: CGPoint(x: 4, y: 42))
// bezierPath.addLine(to: CGPoint(x: 4, y: 34.64))
bezierPath.stroke()
// bezierPath.stroke()
context.restoreGState()
// context.restoreGState()
// bezierPath.close()
// context.saveGState()
// context.restoreGState()
// bezierPath.close ()
// context.saveGState ()
// bezierPath.addClip()
// context.drawLinearGradient(gradient, start: CGPoint(x: 362.5, y: 84), end: CGPoint(x: 362.5, y: 105), options: [])
// context.restoreGState()
}
func getPoints() {
var arr: [CGPoint] = []
print(" getPoints width: \(self.width) height: \(self.height)")
arrData.enumerated().forEach { index, item in
let widht = ( (self.width) - ( CGFloat(padding) * 2))
let height = ( (self.height) - (CGFloat(padding) * 2))
let y = ((( CGFloat(index) / CGFloat(arrData.count) ) * widht) + CGFloat(padding))
let maxHeight = CGFloat(arrData.max() ?? 0)
let x = ((( CGFloat(item) / maxHeight) * height) + CGFloat(padding))
print(" getPoints ( width: \(widht) height: \(height) maxHeight \(maxHeight)) index: \(index), x: \(x) y: \(y)")
arr.append(CGPoint(x: x, y: y))
// bezierPath.move(to: CGPoint(x: x, y: y))
}
}
// func setup() {
//
//
//
//
// if let foundView = viewWithTag(55) {
// foundView.removeFromSuperview()
// }
//
// let d = DesignFigure_(frame: bounds)
// d.backgroundColor = .clear
// d.tag = 55
// d.cornerRadius = cornerRadius
// // d.blur = blur
// // d.image = image
// // d.imageMode = imageMode
// d.fillColor = fillColor
// d.brWidth = brWidth
// d.brColor = brColor
// d.brDash = brDash
// insertSubview(d, at: 0)
//
// }
// override func layoutSubviews() { setup() }
}
@@ -0,0 +1,49 @@
//
// DesignnImageView.swift
// ContainerControllerSwift_Example
//
// Created by Рустам Мотыгуллин on 04.09.2024.
// Copyright © 2024 CocoaPods. All rights reserved.
//
import UIKit
@IBDesignable
class DesignnImageView: UIView {
@IBInspectable var cornerRadius: CGFloat = 0.0
@IBInspectable var fillColor: UIColor?
@IBInspectable var image: UIImage?
@IBInspectable var imageMode: Int = 1
@IBInspectable var blur: CGFloat = 0.0
@IBInspectable var brColor: UIColor = .clear
@IBInspectable var brWidth: CGFloat = 0.0
@IBInspectable var brDash: Int = 0
func setup() {
if let foundView = viewWithTag(55) {
foundView.removeFromSuperview()
}
let d = DesignFigure_(frame: bounds)
d.backgroundColor = .clear
d.tag = 55
d.cornerRadius = cornerRadius
d.blur = blur
d.image = image
d.imageMode = imageMode
d.fillColor = fillColor
d.brWidth = brWidth
d.brColor = brColor
d.brDash = brDash
insertSubview(d, at: 0)
}
override func layoutSubviews() { setup() }
}
@@ -0,0 +1,56 @@
//
// DesignnShadowView.swift
// ContainerControllerSwift_Example
//
// Created by Рустам Мотыгуллин on 04.09.2024.
// Copyright © 2024 CocoaPods. All rights reserved.
//
import UIKit
@IBDesignable
class DesignnShadowView: UIView {
@IBInspectable var cornerRadius: CGFloat = 0.0
@IBInspectable var fillColor: UIColor?
@IBInspectable var brColor: UIColor = .clear
@IBInspectable var brWidth: CGFloat = 0.0
@IBInspectable var brDash: Int = 0
@IBInspectable var shColor: UIColor = .clear
@IBInspectable var shRadius: CGFloat = 0.0
@IBInspectable var shOffset: CGSize = .zero
func setup() {
if let foundView = viewWithTag(55) {
foundView.removeFromSuperview()
}
let d = DesignFigure_(frame: bounds)
d.backgroundColor = .clear
d.tag = 55
d.cornerRadius = cornerRadius
// d.blur = blur
// d.image = image
// d.imageMode = imageMode
d.fillColor = fillColor
d.brWidth = brWidth
d.brColor = brColor
d.brDash = brDash
d.shColor = shColor
d.shRadius = shRadius
d.shOffset = shOffset
insertSubview(d, at: 0)
}
override func layoutSubviews() { setup() }
}
@@ -0,0 +1,47 @@
//
// DesignnView.swift
// ContainerControllerSwift_Example
//
// Created by Рустам Мотыгуллин on 04.09.2024.
// Copyright © 2024 CocoaPods. All rights reserved.
//
import UIKit
@IBDesignable
class DesignnView: UIView {
@IBInspectable var cornerRadius: CGFloat = 0.0
@IBInspectable var fillColor: UIColor?
@IBInspectable var brColor: UIColor = .clear
@IBInspectable var brWidth: CGFloat = 0.0
@IBInspectable var brDash: Int = 0
func setup() {
if let foundView = viewWithTag(55) {
foundView.removeFromSuperview()
}
let d = DesignFigure_(frame: bounds)
d.backgroundColor = .clear
d.tag = 55
d.cornerRadius = cornerRadius
// d.blur = blur
// d.image = image
// d.imageMode = imageMode
d.fillColor = fillColor
d.brWidth = brWidth
d.brColor = brColor
d.brDash = brDash
insertSubview(d, at: 0)
}
// override func layoutSubviews() { setup() }
}
@@ -80,7 +80,8 @@ class BuyStockGraphCell: TableAdapterCell {
@IBOutlet private weak var imageView9: UIImageView?
@IBOutlet private weak var imageView10: UIImageView?
@IBOutlet override var selectedView: UIView? { didSet { } }
@IBOutlet var graphView: DesignnGraphView!
@IBOutlet override var selectedView: UIView? { didSet { } }
@IBOutlet var cardView: UIView?
@IBOutlet var button: UIButton?
@@ -101,6 +102,7 @@ class BuyStockGraphCell: TableAdapterCell {
override func fill(data: TableAdapterCellData?) {
self.imageView10?.alpha = 0.0
graphView.alpha = 0
guard let data = data as? BuyStockGraphCellData else { return }
self.data = data
@@ -121,6 +123,8 @@ class BuyStockGraphCell: TableAdapterCell {
UIView.animate(withDuration: 0.75) {
self.imageView10?.alpha = 1.0
self.graphView?.alpha = 1.0
}
}
}
@@ -4,6 +4,8 @@
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -96,10 +98,64 @@
</imageView>
</subviews>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="imgBuyStockGraph" translatesAutoresizingMaskIntoConstraints="NO" id="CC1-ww-tao" userLabel="imgBuyStockGraph">
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="imgBuyStockGraph" translatesAutoresizingMaskIntoConstraints="NO" id="CC1-ww-tao" userLabel="imgBuyStockGraph">
<rect key="frame" x="70" y="31" width="274" height="152"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="IwI-1N-mMx" customClass="DesignnGraphView" customModule="ContainerController" customModuleProvider="target">
<rect key="frame" x="70" y="20" width="275" height="163"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="arrStr" value="15,25,26,34,35,40,53,56,56,20,15,27,36,46,57,53,90"/>
<userDefinedRuntimeAttribute type="color" keyPath="brColor">
<color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="20"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="brWidth">
<real key="value" value="2"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="padding">
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="addPoints" value="NO"/>
<userDefinedRuntimeAttribute type="color" keyPath="grColor1">
<color key="value" systemColor="systemIndigoColor"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="grColor2">
<color key="value" name="PlayMusicColor"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="grColor3">
<color key="value" name="SportColor"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="point" keyPath="grEndPoint">
<point key="value" x="1" y="0.0"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="point" keyPath="grStartPoint">
<point key="value" x="1" y="1"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="grRadial" value="NO"/>
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
<color key="value" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="grBlendMode">
<integer key="value" value="0"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="gr2Color1">
<color key="value" red="0.92199999089999995" green="0.2669999897" blue="0.3650000095" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="gr2Color2">
<color key="value" red="0.92199999089999995" green="0.2669999897" blue="0.3650000095" alpha="0.78924754159999999" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="point" keyPath="gr2EndPoint">
<point key="value" x="0.0" y="-0.29999999999999999"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="point" keyPath="gr2StartPoint">
<point key="value" x="0.0" y="0.80000000000000004"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="zKf-q8-xby">
<rect key="frame" x="0.0" y="0.0" width="375" height="264"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
@@ -111,6 +167,7 @@
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="button" destination="zKf-q8-xby" id="pQG-FQ-r1n"/>
<outlet property="graphView" destination="IwI-1N-mMx" id="7v0-Lv-csd"/>
<outlet property="imageView10" destination="CC1-ww-tao" id="zEr-Jr-ERV"/>
<outlet property="imageView9" destination="qlN-uP-Jum" id="Z6z-lX-GfC"/>
<outlet property="label2" destination="iVa-IP-Drb" id="0e2-0V-9PR"/>
@@ -123,11 +180,20 @@
<outlet property="subtitleLabel" destination="3yy-Nc-TjF" id="xOz-NI-kur"/>
<outlet property="titleLabel" destination="R0R-ge-Xl5" id="9LK-mm-b8m"/>
</connections>
<point key="canvasLocation" x="138" y="-10"/>
<point key="canvasLocation" x="136.80000000000001" y="-10.794602698650676"/>
</tableViewCell>
</objects>
<resources>
<image name="imgBuyStockGraph" width="822" height="457"/>
<image name="imgBuyStockGraphLine" width="827" height="471"/>
<namedColor name="PlayMusicColor">
<color red="0.92199999094009399" green="0.2669999897480011" blue="0.36500000953674316" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="SportColor">
<color red="1" green="0.54100000858306885" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<systemColor name="systemIndigoColor">
<color red="0.34509803919999998" green="0.33725490200000002" blue="0.83921568629999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
@@ -4,6 +4,7 @@
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
@@ -24,6 +25,7 @@
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="MeV-1F-qzb"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="ibR-u7-zqb" firstAttribute="top" secondItem="soW-Ms-23T" secondAttribute="top" id="7Gy-7x-hGH"/>
@@ -17,7 +17,7 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="33d-WP-EMo" userLabel=" CryptoTitle" customClass="DesignFigure" customModule="ContainerController" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="536"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="593"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0x2-89-aXt" userLabel="Frame 89538">
<rect key="frame" x="9" y="140" width="358" height="156"/>
@@ -14,10 +14,11 @@ class ViewController: UIViewController {
@IBOutlet weak var tableView: TableAdapterView?
var items: [TableAdapterItem] = []
@IBOutlet var graphV: DesignnGraphView!
override func viewDidLoad() {
super.viewDidLoad()
// graphV.getPoints()
let imggAppleMaps = #imageLiteral(resourceName: "imgAppAppleMaps")
let imggPlayMusic = #imageLiteral(resourceName: "imgAppPlayMusic")
+60
View File
@@ -11,11 +11,71 @@
UI Component. This is a copy swipe-panel from app: https://www.apple.com/ios/maps/
It can:
- Animately move top / middle / bottom
- Add multiple ContainerControlleron top of each other in self.view
- Add any type of ScrollView: Table / Collection / Text
- Control Gesture or Scroll
- Pin HeaderView to top / pin FooterView to bottom,
- Add Background Color / background blur transparency
- Adjust cornerRadius edges
- Adjust container shadow
- When raised to top = Add background shadow -
- Has the ability to adjust Left / Right margins
- And adjust Left / Right margins for landscape state.
## About the project
Examples of use (ui swipe component ContainerController) in popular design applications.
It is used in different categories apps:
- Maps / Menu / Player Music / Market / Sports News / Taxi / Finance Banks Stock / Wallets / Analytics / Notes
- Alerts / Popups / Notifications
## Preview
![image](https://github.com/mrustaa/gif_presentation/blob/master/ContainerControllerSwift/maps.gif)
![image](https://github.com/mrustaa/gif_presentation/blob/master/ContainerControllerSwift/examples.gif)
![image(Landscape)](https://github.com/mrustaa/gif_presentation/blob/master/ContainerControllerSwift/mapsLandscape.gif)
## Designs are borrowed from Dribbble
Examples of use (ui swipe component ContainerController) in popular design applications.
To get the design, you need to add a branch
[ui_examples](https://github.com/mrustaa/ContainerController/tree/ui_examples)
```swift
git clone https://github.com/mrustaa/ContainerController.git
cd ContainerController/
git checkout ui_examples
```
It is used in different categories apps:
- Maps / Menu / Player Music / Market / Sports News / Taxi / Finance Banks Stock / Wallets / Analytics / Notes
- Alerts / Popups / Notifications
URLs Author:
- [Play Music](https://dribbble.com/shots/15381326-Move-Multipurpose-HTML-Template-I), [Sallets](https://dribbble.com/shots/18054638-Sowallet-Mobile-Appp), [Crypto](https://dribbble.com/shots/24353177-Crypto-Loan-Mobile-App), [Buy Stock](https://dribbble.com/shots/14364583-Online-Banking-Mobile-App), [Sport](https://dribbble.com/shots/15544535-Sneakers-Shopping-App), [Taxi](https://dribbble.com/shots/23691282-Taxi-Booking-App-Design), [Map Parking](https://dribbble.com/shots/15034854-AirGarage-Mobile-App-Redesign), [Custom Card](https://dribbble.com/shots/20629590-Business-Card-Mobile-IOS-App), [Apple.Maps App](https://apps.apple.com/us/app/apple-maps/id915056765)
GIF Previews:
![image](https://github.com/mrustaa/gif_presentation/blob/master/ContainerControllerSwift/screen_play_music_mini_2.gif)
![image](https://github.com/mrustaa/gif_presentation/blob/master/ContainerControllerSwift/screen_wallets_mini_2.gif)
![image](https://github.com/mrustaa/gif_presentation/blob/master/ContainerControllerSwift/screen_sport_mini_2.gif)
![image](https://github.com/mrustaa/gif_presentation/blob/master/ContainerControllerSwift/screen_buy_stock_mini_2.gif)
![image](https://github.com/mrustaa/gif_presentation/blob/master/ContainerControllerSwift/screen_crypto_mini_2.gif)
![image](https://github.com/mrustaa/gif_presentation/blob/master/ContainerControllerSwift/screen_taxi_mini_2.gif)
![image](https://github.com/mrustaa/gif_presentation/blob/master/ContainerControllerSwift/screen_map_parking_mini_2.gif)
![image](https://github.com/mrustaa/gif_presentation/blob/master/ContainerControllerSwift/screen_custom_card_mini_2.gif)
## Features
<!-- TOC -->
- [Requirements](#requirements)