From 8a914641ef82e7d2cae4bc6e256ecb4eebd791aa Mon Sep 17 00:00:00 2001 From: Badarinath Venkatnarayansetty Date: Mon, 11 May 2020 17:53:36 -0700 Subject: [PATCH] Added an example fo animated step indicatpr for apple watch --- Example/StepperView.xcodeproj/project.pbxproj | 4 ++ Example/StepperView/ExampleView5.swift | 3 +- Example/StepperView/ExampleView7.swift | 3 +- .../Views/WatchExampleView5.swift | 37 +++++++++++++++++++ .../WatchHostingController.swift | 5 ++- 5 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 Example/StepperView_Watch Extension/Views/WatchExampleView5.swift diff --git a/Example/StepperView.xcodeproj/project.pbxproj b/Example/StepperView.xcodeproj/project.pbxproj index f9f91c6..f56c08e 100644 --- a/Example/StepperView.xcodeproj/project.pbxproj +++ b/Example/StepperView.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ 1BA9B80C2447DCC8007A6BB9 /* ExampleView5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BA9B80B2447DCC8007A6BB9 /* ExampleView5.swift */; }; 1BD0BECE2468C8EF005CE5FE /* WatchExampleView4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BD0BECD2468C8EF005CE5FE /* WatchExampleView4.swift */; }; 1BD0BED32469C574005CE5FE /* ExampleView7.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BD0BED22469C574005CE5FE /* ExampleView7.swift */; }; + 1BD0BEDB246A27A4005CE5FE /* WatchExampleView5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BD0BEDA246A27A4005CE5FE /* WatchExampleView5.swift */; }; 1BD42F2624552D3F008D4DAB /* ExampleView6.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BD42F2524552D3F008D4DAB /* ExampleView6.swift */; }; 1BD7CB6C243FC0CE00F17698 /* ExampleView3.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BD7CB6B243FC0CE00F17698 /* ExampleView3.swift */; }; 1BD7CB70243FCD4800F17698 /* ImageTextRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BD7CB6F243FCD4800F17698 /* ImageTextRowView.swift */; }; @@ -118,6 +119,7 @@ 1BA9B80B2447DCC8007A6BB9 /* ExampleView5.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleView5.swift; sourceTree = ""; }; 1BD0BECD2468C8EF005CE5FE /* WatchExampleView4.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchExampleView4.swift; sourceTree = ""; }; 1BD0BED22469C574005CE5FE /* ExampleView7.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleView7.swift; sourceTree = ""; }; + 1BD0BEDA246A27A4005CE5FE /* WatchExampleView5.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchExampleView5.swift; sourceTree = ""; }; 1BD42F2524552D3F008D4DAB /* ExampleView6.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleView6.swift; sourceTree = ""; }; 1BD7CB6B243FC0CE00F17698 /* ExampleView3.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleView3.swift; sourceTree = ""; }; 1BD7CB6F243FCD4800F17698 /* ImageTextRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageTextRowView.swift; sourceTree = ""; }; @@ -236,6 +238,7 @@ 1B4874DC2467B59400B253C6 /* WatchExampleView2.swift */, 1B4874DE2467B70600B253C6 /* WatchExampleView3.swift */, 1BD0BECD2468C8EF005CE5FE /* WatchExampleView4.swift */, + 1BD0BEDA246A27A4005CE5FE /* WatchExampleView5.swift */, ); path = Views; sourceTree = ""; @@ -693,6 +696,7 @@ buildActionMask = 2147483647; files = ( 1B4874C62467175400B253C6 /* NotificationController.swift in Sources */, + 1BD0BEDB246A27A4005CE5FE /* WatchExampleView5.swift in Sources */, 1B4874C82467175400B253C6 /* ComplicationController.swift in Sources */, 1B4874DF2467B70600B253C6 /* WatchExampleView3.swift in Sources */, 1B4874C42467175400B253C6 /* ExtensionDelegate.swift in Sources */, diff --git a/Example/StepperView/ExampleView5.swift b/Example/StepperView/ExampleView5.swift index c5bb161..5d39430 100644 --- a/Example/StepperView/ExampleView5.swift +++ b/Example/StepperView/ExampleView5.swift @@ -73,8 +73,7 @@ struct ExampleView5: View { .indicators(self.indicationTypes1) .spacing(30) .lineOptions(StepperLineOptions.custom(1, Colors.blue(.teal).rawValue)) - .loadingAnimationTime(0.02) - .animateSteps(self.set3.count) + .loadingAnimationTime(0.02) // speed of the animation. } } .navigationBarTitle("StepperView") diff --git a/Example/StepperView/ExampleView7.swift b/Example/StepperView/ExampleView7.swift index 13073fe..6fd34b9 100644 --- a/Example/StepperView/ExampleView7.swift +++ b/Example/StepperView/ExampleView7.swift @@ -32,7 +32,6 @@ struct ExampleView7: View { .stepIndicatorMode(StepperMode.horizontal) .spacing(50) .lineOptions(StepperLineOptions.custom(1, Colors.blue(.teal).rawValue)) - .loadingAnimationTime(0.02) - .animateSteps(self.set.count) + .loadingAnimationTime(0.02) //speed of the animation } } diff --git a/Example/StepperView_Watch Extension/Views/WatchExampleView5.swift b/Example/StepperView_Watch Extension/Views/WatchExampleView5.swift new file mode 100644 index 0000000..9706c4f --- /dev/null +++ b/Example/StepperView_Watch Extension/Views/WatchExampleView5.swift @@ -0,0 +1,37 @@ +// +// WatchExampleView5.swift +// StepperView_Watch Extension +// +// Created by Venkatnarayansetty, Badarinath on 5/11/20. +// Copyright © 2020 CocoaPods. All rights reserved. +// + +import Foundation +import SwiftUI +import StepperView + +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +struct WatchExampleView5: View { + + let indicationTypes = [ + StepperIndicationType.animation(NumberedCircleView(text: "1")), + .animation(NumberedCircleView(text: "2")), + .animation(NumberedCircleView(text: "3")), + .animation(NumberedCircleView(text: "4"))] + + let set = [ TextView(text: "Campaign", font: Font.system(size: 12, weight: Font.Weight.semibold)), + TextView(text:"Contents", font: Font.system(size: 12, weight: Font.Weight.semibold)), + TextView(text:"Recipients", font: Font.system(size: 12, weight: Font.Weight.semibold)), + TextView(text:"Delivery", font: Font.system(size: 12, weight: Font.Weight.semibold))] + + var body: some View { + StepperView() + .addSteps(self.set) + .indicators(self.indicationTypes) + .stepIndicatorMode(StepperMode.vertical) + .spacing(15) + .lineOptions(StepperLineOptions.custom(1, Colors.blue(.lightSky).rawValue)) + .padding(.leading, 10) + .padding(.top, 10) + } +} diff --git a/Example/StepperView_Watch Extension/WatchHostingController.swift b/Example/StepperView_Watch Extension/WatchHostingController.swift index a903931..b6ee87b 100644 --- a/Example/StepperView_Watch Extension/WatchHostingController.swift +++ b/Example/StepperView_Watch Extension/WatchHostingController.swift @@ -16,7 +16,7 @@ class WatchHostingController: WKHostingController { override var body: AnyView { /// Vertical StepperView - return WatchExampleView1().eraseToAnyView() + //return WatchExampleView1().eraseToAnyView() // Horizontal StepperView //return WatchExampleView2().eraseToAnyView() @@ -26,5 +26,8 @@ class WatchHostingController: WKHostingController { // Pitstop StepperView //return WatchExampleView4().eraseToAnyView() + + // animated step indicator stepper view + return WatchExampleView5().eraseToAnyView() } }