Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Demo] Added SnackbarView swiftUI demo #1096

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .Demo/App/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
//

import UIKit
import SwiftUI
import SparkSnackbar
import SparkButton
import SparkTheming

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

Expand All @@ -16,6 +20,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
guard let windowScene = scene as? UIWindowScene else { return }

let window = UIWindow(windowScene: windowScene)
SparkConfiguration.load()
window.rootViewController = SparkTabbarController()
self.window = window
window.makeKeyAndVisible()
Expand Down
13 changes: 13 additions & 0 deletions .Demo/Classes/Enum/Components.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Components.swift
// SparkDemo
//
// Created by louis.borlee on 19/09/2024.
// Copyright © 2024 Adevinta. All rights reserved.
//

import Foundation

enum Components: CaseIterable {
case snackbar
}
18 changes: 8 additions & 10 deletions .Demo/Classes/Tabbar/SparkTabbarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,16 @@ public final class SparkTabbarController: UITabBarController {
}()

/// Third Tab
private lazy var listViewController: UIViewController = {
let layout = ComponentsViewController.makeLayout()
let viewController = UINavigationController(rootViewController: ListComponentsViewController(collectionViewLayout: layout))
viewController.tabBarItem = UITabBarItem(title: "List", image: UIImage(systemName: "list.bullet.rectangle"), tag: 0)
private lazy var uiKitViewController: UIViewController = {
let viewController = UIHostingController(rootView: NewComponentsView(isUIKit: true))
viewController.tabBarItem = UITabBarItem(title: "UIKit", image: UIImage(systemName: "u.circle"), tag: 0)
return viewController
}()

/// Fourth Tab
private lazy var settingsViewController: UIViewController = {
var layout = SettingsViewController.makeLayout()
let viewController = UINavigationController(rootViewController: SettingsViewController(collectionViewLayout: layout))
viewController.tabBarItem = UITabBarItem(title: "Settings", image: UIImage(systemName: "gear"), tag: 0)
private lazy var swiftUIViewController: UIViewController = {
let viewController = UIHostingController(rootView: NewComponentsView(isUIKit: false))
viewController.tabBarItem = UITabBarItem(title: "SwiftUI", image: UIImage(systemName: "s.circle"), tag: 0)
return viewController
}()

Expand All @@ -67,8 +65,8 @@ public final class SparkTabbarController: UITabBarController {
viewControllers = [
self.themeViewController,
self.componentVersionViewController,
self.listViewController,
self.settingsViewController
self.uiKitViewController,
self.swiftUIViewController
]
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// OptionalEnumSelector.swift
// SparkDemo
//
// Created by louis.borlee on 19/09/2024.
// Copyright © 2024 Adevinta. All rights reserved.
//

import SwiftUI

struct OptionalEnumSelector<Value>: View where Value: CaseIterable & Hashable {
let title: String
let dialogTitle: String
let values: [Value]
@Binding var value: Value?

var nameFormatter: (Value?) -> String = { value in
return value?.name ?? "Default"
}

@State private var isPresented = false

var body: some View {
HStack() {
Text("\(title): ").bold()
Button(self.nameFormatter(value)) {
self.isPresented = true
}
.confirmationDialog(dialogTitle, isPresented: self.$isPresented) {
ForEach(self.values, id: \.self) { value in
Button(self.nameFormatter(value)) {
self.value = value
}
}
Button("Default") {
self.value = nil
}
}
}
}
}
43 changes: 0 additions & 43 deletions .Demo/Classes/View/ListView/Cells/BadgeCell/BadgeCell.swift

This file was deleted.

This file was deleted.

77 changes: 0 additions & 77 deletions .Demo/Classes/View/ListView/Cells/ButtonCell/ButtonCell.swift

This file was deleted.

This file was deleted.

55 changes: 0 additions & 55 deletions .Demo/Classes/View/ListView/Cells/CheckboxCell/CheckboxCell.swift

This file was deleted.

This file was deleted.

Loading
Loading