Commit e68fcfc6 by Dmitriy Stepanets

Started implementing custom progress

parent a4f79190
......@@ -86,6 +86,7 @@
CD6761802625B0F50079D273 /* RadarLayerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD67617F2625B0F50079D273 /* RadarLayerCell.swift */; };
CD6761842625B6A10079D273 /* RadarLayersCellFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6761832625B6A10079D273 /* RadarLayersCellFactory.swift */; };
CD6761882625C3360079D273 /* RadarViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6761872625C3360079D273 /* RadarViewModel.swift */; };
CD6B2C8426C55F4600473B2D /* OnboardingPageControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6B2C8326C55F4600473B2D /* OnboardingPageControl.swift */; };
CD6B303B2572680C004B34B3 /* SelfSizingButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6B303A2572680C004B34B3 /* SelfSizingButton.swift */; };
CD6B303E25726960004B34B3 /* ThemeProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6B303D25726960004B34B3 /* ThemeProtocol.swift */; };
CD6B304325726AD1004B34B3 /* DefaultTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6B304225726AD1004B34B3 /* DefaultTheme.swift */; };
......@@ -343,6 +344,7 @@
CD67617F2625B0F50079D273 /* RadarLayerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadarLayerCell.swift; sourceTree = "<group>"; };
CD6761832625B6A10079D273 /* RadarLayersCellFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadarLayersCellFactory.swift; sourceTree = "<group>"; };
CD6761872625C3360079D273 /* RadarViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadarViewModel.swift; sourceTree = "<group>"; };
CD6B2C8326C55F4600473B2D /* OnboardingPageControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingPageControl.swift; sourceTree = "<group>"; };
CD6B303A2572680C004B34B3 /* SelfSizingButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelfSizingButton.swift; sourceTree = "<group>"; };
CD6B303D25726960004B34B3 /* ThemeProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeProtocol.swift; sourceTree = "<group>"; };
CD6B304225726AD1004B34B3 /* DefaultTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultTheme.swift; sourceTree = "<group>"; };
......@@ -1031,6 +1033,7 @@
children = (
CDC62C4426C13B9200156643 /* OnboardingPageController.swift */,
CDC62C4626C13BE300156643 /* OnboardingContentController.swift */,
CD6B2C8326C55F4600473B2D /* OnboardingPageControl.swift */,
);
path = InitialOnboarding;
sourceTree = "<group>";
......@@ -1737,6 +1740,7 @@
CD37D3F6260DF5BA002669D6 /* SettingsViewModel.swift in Sources */,
CD17C5F625D15B4400EE884E /* TodayViewController.swift in Sources */,
CD86245E25E646350097F3FB /* SunUvView.swift in Sources */,
CD6B2C8426C55F4600473B2D /* OnboardingPageControl.swift in Sources */,
CD427D2A266F86C600B4350A /* ShortsManager.swift in Sources */,
CDF8F12D26208E7B00DB384A /* MapCurrentTimeView.swift in Sources */,
CE6F5F0C263C8B3D00973137 /* SmartTextProvider.swift in Sources */,
......
......@@ -80,8 +80,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
FirebaseApp.configure()
ConfigManager.shared.updateConfig()
let appCoordinator = AppCoordinator(window: self.window!)
appCoordinator.start()
//App UI
#if DEBUG
window?.rootViewController = OnboardingPageController(coordinator: AppCoordinator(window: self.window!))
window?.makeKeyAndVisible()
// let appCoordinator = AppCoordinator(window: self.window!)
// appCoordinator.start()
#else
fatalError("Remove in release build")
#endif
ThemeManager.setBaseTheme()
......
//
// OnboardingPageControl.swift
// 1Weather
//
// Created by Dmitry Stepanets on 12.08.2021.
//
import UIKit
class OnboardingPageControl: UIView {
//Private
private let kSpacePerDot: CGFloat = 10
private let kDotSize: CGSize = .init(width: 9, height: 9)
private let totalPagesCount: Int
private let indicator = CAShapeLayer()
private var dots = [CAShapeLayer]()
init(totalPagesCount: Int) {
self.totalPagesCount = totalPagesCount
super.init(frame: .zero)
prepareDots()
prepareIndicator()
}
override func layoutSubviews() {
super.layoutSubviews()
self.frame.size.width = CGFloat(totalPagesCount) * kDotSize.width + kSpacePerDot * (CGFloat(totalPagesCount) - 1)
self.frame.size.height = kDotSize.height
//Dots
for (index, dot) in dots.enumerated() {
let cgIndex = CGFloat(index)
let space = index == 0 ? 0 : kSpacePerDot
let rect = CGRect(origin: .init(x: cgIndex * (kDotSize.width + space), y: 0), size: kDotSize)
dot.path = CGPath(ellipseIn: rect, transform: nil)
print("Dot- index: \(index) rect: \(rect)")
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func scroll(toPage index: Int, progress: CGFloat) {
var scrollProgress = max(0, progress)
scrollProgress = min(progress, 1)
}
}
private extension OnboardingPageControl {
func prepareDots() {
for _ in 0..<totalPagesCount {
let dot = CAShapeLayer()
dot.fillColor = UIColor.blue.cgColor
layer.addSublayer(dot)
dots.append(dot)
}
}
func prepareIndicator() {
indicator.fillColor = UIColor.red.cgColor
indicator.path = UIBezierPath(roundedRect: .init(origin: .zero, size: kDotSize),
cornerRadius: kDotSize.height / 2).cgPath
layer.addSublayer(indicator)
}
}
......@@ -72,6 +72,15 @@ class OnboardingPageController: UIPageViewController {
override func viewDidLoad() {
super.viewDidLoad()
#if DEBUG
let control = OnboardingPageControl(totalPagesCount: 5)
view.addSubview(control)
control.frame.origin.x = 100
control.frame.origin.y = 80
#else
fatalError("Remove in release")
#endif
prepareController()
prepareCloseButton()
preparePageControl()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment