Skip to content

Commit

Permalink
Build On Boarding Screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Yazan98 committed Sep 1, 2023
1 parent c45eeab commit da57595
Show file tree
Hide file tree
Showing 21 changed files with 344 additions and 19 deletions.
Binary file modified .DS_Store
Binary file not shown.
20 changes: 16 additions & 4 deletions RM Client.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
8A0FC3632A9FFEAF00F4B558 /* RmBaseVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A0FC3622A9FFEAF00F4B558 /* RmBaseVC.swift */; };
8A0FC3652A9FFFF900F4B558 /* AuthScreenVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A0FC3642A9FFFF900F4B558 /* AuthScreenVC.swift */; };
8A0FC3672AA004A600F4B558 /* RmThemeUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A0FC3662AA004A600F4B558 /* RmThemeUtils.swift */; };
8A0FC3692AA0058B00F4B558 /* OnBoardingScreenVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A0FC3682AA0058B00F4B558 /* OnBoardingScreenVC.swift */; };
8A0FC36B2AA005FB00F4B558 /* HomeScreenVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A0FC36A2AA005FB00F4B558 /* HomeScreenVC.swift */; };
8A1AE2512AA1781D00EED489 /* OnBoardingScreenVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A1AE24F2AA1781D00EED489 /* OnBoardingScreenVC.swift */; };
8A1AE2522AA1781D00EED489 /* OnBoardingScreenVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8A1AE2502AA1781D00EED489 /* OnBoardingScreenVC.xib */; };
8A1AE2552AA1819900EED489 /* OnBoardingTabViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A1AE2532AA1819900EED489 /* OnBoardingTabViewController.swift */; };
8A1AE2562AA1819900EED489 /* OnBoardingTabViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8A1AE2542AA1819900EED489 /* OnBoardingTabViewController.xib */; };
8A38D6342A9FF870003FB5DA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A38D6332A9FF870003FB5DA /* AppDelegate.swift */; };
8A38D6362A9FF870003FB5DA /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A38D6352A9FF870003FB5DA /* SceneDelegate.swift */; };
8A38D6382A9FF870003FB5DA /* SplashScreenVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A38D6372A9FF870003FB5DA /* SplashScreenVC.swift */; };
Expand Down Expand Up @@ -55,8 +58,11 @@
8A0FC3622A9FFEAF00F4B558 /* RmBaseVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RmBaseVC.swift; sourceTree = "<group>"; };
8A0FC3642A9FFFF900F4B558 /* AuthScreenVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthScreenVC.swift; sourceTree = "<group>"; };
8A0FC3662AA004A600F4B558 /* RmThemeUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RmThemeUtils.swift; sourceTree = "<group>"; };
8A0FC3682AA0058B00F4B558 /* OnBoardingScreenVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnBoardingScreenVC.swift; sourceTree = "<group>"; };
8A0FC36A2AA005FB00F4B558 /* HomeScreenVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenVC.swift; sourceTree = "<group>"; };
8A1AE24F2AA1781D00EED489 /* OnBoardingScreenVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnBoardingScreenVC.swift; sourceTree = "<group>"; };
8A1AE2502AA1781D00EED489 /* OnBoardingScreenVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = OnBoardingScreenVC.xib; sourceTree = "<group>"; };
8A1AE2532AA1819900EED489 /* OnBoardingTabViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnBoardingTabViewController.swift; sourceTree = "<group>"; };
8A1AE2542AA1819900EED489 /* OnBoardingTabViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = OnBoardingTabViewController.xib; sourceTree = "<group>"; };
8A38D6302A9FF870003FB5DA /* RM Client.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "RM Client.app"; sourceTree = BUILT_PRODUCTS_DIR; };
8A38D6332A9FF870003FB5DA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
8A38D6352A9FF870003FB5DA /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -189,7 +195,10 @@
8A0FC3602A9FFD9400F4B558 /* OnBoarding */ = {
isa = PBXGroup;
children = (
8A0FC3682AA0058B00F4B558 /* OnBoardingScreenVC.swift */,
8A1AE24F2AA1781D00EED489 /* OnBoardingScreenVC.swift */,
8A1AE2502AA1781D00EED489 /* OnBoardingScreenVC.xib */,
8A1AE2532AA1819900EED489 /* OnBoardingTabViewController.swift */,
8A1AE2542AA1819900EED489 /* OnBoardingTabViewController.xib */,
);
path = OnBoarding;
sourceTree = "<group>";
Expand Down Expand Up @@ -368,7 +377,9 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8A1AE2562AA1819900EED489 /* OnBoardingTabViewController.xib in Resources */,
8A38D63D2A9FF873003FB5DA /* Assets.xcassets in Resources */,
8A1AE2522AA1781D00EED489 /* OnBoardingScreenVC.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -499,11 +510,12 @@
8A38D6382A9FF870003FB5DA /* SplashScreenVC.swift in Sources */,
8A38D6342A9FF870003FB5DA /* AppDelegate.swift in Sources */,
8A0FC3652A9FFFF900F4B558 /* AuthScreenVC.swift in Sources */,
8A1AE2552AA1819900EED489 /* OnBoardingTabViewController.swift in Sources */,
8A0FC35F2A9FFCE400F4B558 /* RmLocalStorage.swift in Sources */,
8A0FC3672AA004A600F4B558 /* RmThemeUtils.swift in Sources */,
8A1AE2512AA1781D00EED489 /* OnBoardingScreenVC.swift in Sources */,
8A0FC3632A9FFEAF00F4B558 /* RmBaseVC.swift in Sources */,
8A38D6362A9FF870003FB5DA /* SceneDelegate.swift in Sources */,
8A0FC3692AA0058B00F4B558 /* OnBoardingScreenVC.swift in Sources */,
8A0FC36B2AA005FB00F4B558 /* HomeScreenVC.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Binary file not shown.
23 changes: 23 additions & 0 deletions RM Client/Assets.xcassets/OnBoardingImage1.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "undraw_Movie_night_re_9umk.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "undraw_Movie_night_re_9umk 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "undraw_Movie_night_re_9umk 2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions RM Client/Assets.xcassets/OnBoardingImage2.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "undraw_New_ideas_re_asn4.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "undraw_New_ideas_re_asn4 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "undraw_New_ideas_re_asn4 2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions RM Client/Assets.xcassets/OnBoardingImage3.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "undraw_Outer_space_re_u9vd.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "undraw_Outer_space_re_u9vd 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "undraw_Outer_space_re_u9vd 2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions RM Client/Assets.xcassets/PrimaryColor.colorset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "0.813",
"red" : "0.061"
"blue" : "0xFF",
"green" : "0x63",
"red" : "0x6C"
}
},
"idiom" : "universal"
Expand All @@ -23,9 +23,9 @@
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "0.813",
"red" : "0.061"
"blue" : "0xFF",
"green" : "0x63",
"red" : "0x6C"
}
},
"idiom" : "universal"
Expand Down
82 changes: 75 additions & 7 deletions RM Client/Features/OnBoarding/OnBoardingScreenVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,92 @@
// OnBoardingScreenVC.swift
// RM Client
//
// Created by Yazan Tarifi on 31/08/2023.
// Created by Yazan Tarifi on 01/09/2023.
//

import Foundation
import UIKit

public class OnBoardingScreenVC: RmBaseVC {
class OnBoardingScreenVC: UIPageViewController, UIPageViewControllerDelegate, UIPageViewControllerDataSource {

private var pageViewController: UIPageControl = UIPageControl()
private var pages: [UIViewController] = []

public static func getInstance() -> OnBoardingScreenVC {
return OnBoardingScreenVC()
}

public override func onScreenStarted() {
super.onScreenStarted()
override init(transitionStyle style: UIPageViewController.TransitionStyle, navigationOrientation: UIPageViewController.NavigationOrientation, options: [UIPageViewController.OptionsKey : Any]? = nil) {
super.init(transitionStyle: .scroll, navigationOrientation: .horizontal)
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemBackground
title = "Welcome"

delegate = self
dataSource = self

if let firstOnBoardingViewController = getViewControllersList().first {
setViewControllers([firstOnBoardingViewController], direction: .forward, animated: true)
}

addPagerViewControl()
}

func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? {
guard let pagerCurrentIndex = getViewControllersList().firstIndex(of: viewController) else { return nil }
let pagerPrevIndex = pagerCurrentIndex - 1
guard pagerPrevIndex >= 0 else { return nil }
return getViewControllersList()[pagerPrevIndex]
}

public override func getTitle() -> String {
return "Welcome"
func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? {
guard let pagerCurrentIndex = getViewControllersList().firstIndex(of: viewController) else { return nil }
let pagerNextIndex = pagerCurrentIndex + 1
guard pagerNextIndex < getViewControllersList().count else { return nil }
return getViewControllersList()[pagerNextIndex]
}

func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
let pageViewController = pageViewController.viewControllers?[0] ?? getViewControllersList().first
self.pageViewController.currentPage = getViewControllersList().firstIndex(of: pageViewController!) ?? 0
}

private func getViewControllersList() -> [UIViewController] {
if pages.isEmpty {
pages = self.getViewControllersPager()
}

return pages
}

private func addPagerViewControl() {
pageViewController = UIPageControl(frame: CGRect(
x: 0,
y: UIScreen.main.bounds.maxY - 75,
width: UIScreen.main.bounds.width,
height: 50
))

self.pageViewController.numberOfPages = getViewControllersList().count
self.pageViewController.currentPage = 0
self.pageViewController.pageIndicatorTintColor = .systemGray
self.pageViewController.tintColor = RmThemeUtils.shared.getApplicationPrimaryColor()
self.pageViewController.currentPageIndicatorTintColor = RmThemeUtils.shared.getApplicationPrimaryColor()
self.view.addSubview(pageViewController)
}

private func getViewControllersPager() -> [UIViewController] {
return [
OnBoardingTabViewController.getInstance(index: 0),
OnBoardingTabViewController.getInstance(index: 1),
OnBoardingTabViewController.getInstance(index: 2),
]
}

}
30 changes: 30 additions & 0 deletions RM Client/Features/OnBoarding/OnBoardingScreenVC.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
<capability name="Safe area layout guides" 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>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="OnBoardingScreenVC" customModule="RM_Client" customModuleProvider="target">
<connections>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<point key="canvasLocation" x="132" y="-11"/>
</view>
</objects>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
56 changes: 56 additions & 0 deletions RM Client/Features/OnBoarding/OnBoardingTabViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// OnBoardingTabViewController.swift
// RM Client
//
// Created by Yazan Tarifi on 01/09/2023.
//

import UIKit

class OnBoardingTabViewController: UIViewController {

@IBOutlet weak var tabTitleLabel: UILabel!
@IBOutlet weak var imageViewInstance: UIImageView!
@IBOutlet weak var tabDescriptionLabel: UILabel!
@IBOutlet weak var continueButtonInstance: UIButton!
private var tabIndex: Int = 0
private let titles = [
"Rick And Morty TV Show",
"Discover News",
"Next Version of the Planet"
]

private let messages = [
"Welcome to Rick and Morty IOS Client Application, this is the First Full Demo App Contains Most cases of IOS App Development, Swipe Ma Friendo Swipe",
"You can Here Descover Characters, Stories, Articles and More, Swipe Ma Friendo Swipe",
"You Can go to Another Planet in this Application by Trying Morty Expermentals Click Continue to Continue xD"
]

public static func getInstance(index: Int) -> OnBoardingTabViewController {
let vc = OnBoardingTabViewController()
vc.addTabIndex(index: index)
return vc
}

override func viewDidLoad() {
super.viewDidLoad()
if tabIndex == 2 {
continueButtonInstance?.isHidden = false
} else {
continueButtonInstance?.isHidden = true
}

imageViewInstance?.image = UIImage(named: "OnBoardingImage\(tabIndex + 1)")
tabTitleLabel?.text = titles[tabIndex]
tabDescriptionLabel?.text = messages[tabIndex]
}
@IBAction func onContinueButtonListener(_ sender: Any) {
RmLocalStorage.shared.onUpdateAppOpeningStatus(newStatus: true)
self.navigationController?.pushViewController(HomeScreenVC.getInstance(), animated: true)
}

public func addTabIndex(index: Int) {
self.tabIndex = index
}

}
Loading

0 comments on commit da57595

Please sign in to comment.