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

[IRP-1015] SPM migration #1029

Merged
merged 2 commits into from
Jul 16, 2024
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions spark/Demo/AppDelegate.swift → .Demo/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

import UIKit
@_exported import SparkCore
@_exported import SparkCoreTesting

/// Appdelegate was added for starting app with a viewcontroller. So It help us to integrate UIkit components to UIViewController class diretly. SwiftUI components are working on UIHostingController class more stablize than UIkit components that was integrated with a UIViewRepresentable class.
@main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

import UIKit

// swiftlint:disable all

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2023 Adevinta. All rights reserved.
//

import Spark
@_spi(SI_SPI) import SparkCommon
import SwiftUI
import SparkCore

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Combine
import Foundation
import UIKit
@_spi(SI_SPI) import SparkCommon

final class Console {
static var publisher: some Publisher<String, Never> {
Expand All @@ -20,7 +21,7 @@ final class Console {
}
}

final class ConsoleView: UIView {
public final class ConsoleView: UIView {

enum Constants {
static let fullWidth: CGFloat = 200
Expand All @@ -29,7 +30,7 @@ final class ConsoleView: UIView {

private var dataSource = [String]()

static let shared = ConsoleView()
public static let shared = ConsoleView()

private var width: CGFloat {
return self.consoleButton.isSelected ? Constants.fullWidth : Constants.collapsedWidth
Expand Down Expand Up @@ -87,7 +88,7 @@ final class ConsoleView: UIView {
fatalError("init(coder:) has not been implemented")
}

func show() {
public func show() {
guard let window = UIApplication.shared.windows.last else {
return
}
Expand Down Expand Up @@ -178,18 +179,18 @@ final class ConsoleView: UIView {
}

extension ConsoleView: UITableViewDelegate {
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
public func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return 12.0
}
}

extension ConsoleView: UITableViewDataSource {

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return section == 0 ? self.dataSource.count : 0
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = self.tableView.dequeueReusableCell(withIdentifier: ConsoleTableViewCell.cellIdentifier) as? ConsoleTableViewCell else {
fatalError("Couldn't dequeue table view cell")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@

import UIKit
import SwiftUI
import Spark
import SparkCore
import Combine

final class SparkTabbarController: UITabBarController {
public final class SparkTabbarController: UITabBarController {

// MARK: - Published Properties
@ObservedObject private var themePublisher = SparkThemePublisher.shared
Expand Down Expand Up @@ -52,7 +51,7 @@ final class SparkTabbarController: UITabBarController {
}()

// MARK: - ViewDidLoad
override func viewDidLoad() {
public override func viewDidLoad() {
super.viewDidLoad()

self.loadSparkConfiguration()
Expand All @@ -77,9 +76,9 @@ final class SparkTabbarController: UITabBarController {
self.themePublisher
.$theme
.eraseToAnyPublisher()
.sink(receiveValue: { theme in
self.tabBar.tintColor = theme.colors.main.main.uiColor
})
.store(in: &cancellables)
.sink { theme in
self.tabBar.tintColor = theme.colors.main.main.uiColor
}
.store(in: &cancellables)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import Foundation
import SparkCore
import Spark

public class SparkThemePublisher: ObservableObject {
public static let shared = SparkThemePublisher()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2023 Adevinta. All rights reserved.
//

import Spark
@_spi(SI_SPI) import SparkCommon
import SparkCore
import SwiftUI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2023 Adevinta. All rights reserved.
//

import Spark
@_spi(SI_SPI) import SparkCommon
import SparkCore
import SwiftUI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit
import Combine
import SparkCore
import Spark
@_spi(SI_SPI) import SparkCommon

final class BadgeComponentUIView: UIView {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

import Combine
import Spark
@_spi(SI_SPI) import SparkCommon
import SparkCore
import UIKit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
//

import Combine
import Spark
import SwiftUI
import UIKit
import SparkCore
@_spi(SI_SPI) import SparkCommon

final class BadgeComponentViewController: UIViewController {

Expand Down Expand Up @@ -51,11 +51,11 @@ final class BadgeComponentViewController: UIViewController {

themePublisher
.$theme
.sink(receiveValue: { [weak self] theme in
.sink { [weak self] theme in
guard let self = self else { return }
self.viewModel.theme = theme
self.navigationController?.navigationBar.tintColor = theme.colors.main.main.uiColor
})
}
.store(in: &self.cancellables)

self.viewModel.showThemeSheet.subscribe(in: &self.cancellables) { intents in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

import SwiftUI
import Spark
@_spi(SI_SPI) import SparkCommon
import SparkCore

struct ButtonComponentView: View {
Expand Down Expand Up @@ -194,7 +194,6 @@ private extension ButtonView {
case .highlighted: image = Image("close")
case .disabled: image = Image("check")
case .selected: image = Image("alert")
@unknown default: break
}
}

Expand All @@ -221,7 +220,6 @@ private extension ButtonView {
case .highlighted: title = "My Highlighted"
case .disabled: title = "My Disabled"
case .selected: title = "My Selected"
@unknown default: break
}

if content.containsAttributedText, let title {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit
import Combine
import SparkCore
import Spark
@_spi(SI_SPI) import SparkCommon

final class ButtonComponentUIView: ComponentUIView {

Expand Down Expand Up @@ -233,7 +233,6 @@ final class ButtonComponentUIView: ComponentUIView {
case .highlighted: return UIImage(named: "close")
case .disabled: return UIImage(named: "check")
case .selected: return UIImage(named: "alert")
@unknown default: return nil
}
}

Expand All @@ -243,7 +242,6 @@ final class ButtonComponentUIView: ComponentUIView {
case .highlighted: return "My Highlighted"
case .disabled: return "My Disabled"
case .selected: return "My Selected"
@unknown default: return nil
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

import Combine
import Spark
import SparkCore
import UIKit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
//

import Combine
import Spark
import SwiftUI
import UIKit
import SparkCore
@_spi(SI_SPI) import SparkCommon

final class ButtonComponentViewController: UIViewController {

Expand Down Expand Up @@ -53,11 +53,11 @@ final class ButtonComponentViewController: UIViewController {

themePublisher
.$theme
.sink(receiveValue: { [weak self] theme in
.sink { [weak self] theme in
guard let self = self else { return }
self.viewModel.theme = theme
self.navigationController?.navigationBar.tintColor = theme.colors.main.main.uiColor
})
}
.store(in: &self.cancellables)

self.viewModel.showThemeSheet.subscribe(in: &self.cancellables) { intents in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2023 Adevinta. All rights reserved.
//

import Spark
@_spi(SI_SPI) import SparkCommon
import SparkCore
import SwiftUI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

import Combine
import Spark
@_spi(SI_SPI) import SparkCommon
import SparkCore
import SwiftUI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

import Combine
import SparkCore
import Spark
import UIKit
@_spi(SI_SPI) import SparkCommon

final class CheckboxComponentUIView: ComponentUIView {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
//

import Combine
import Spark
import SparkCore
import SwiftUI
import UIKit
@_spi(SI_SPI) import SparkCommon

final class CheckboxComponentUIViewController: UIViewController {

Expand Down Expand Up @@ -51,11 +51,11 @@ final class CheckboxComponentUIViewController: UIViewController {

self.themePublisher
.$theme
.sink(receiveValue: { [weak self] theme in
.sink { [weak self] theme in
guard let self = self else { return }
self.viewModel.theme = theme
self.navigationController?.navigationBar.tintColor = theme.colors.main.main.uiColor
})
}
.store(in: &self.cancellables)

self.viewModel.showThemeSheet.subscribe(in: &self.cancellables) { intents in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

import Combine
import Spark
@_spi(SI_SPI) import SparkCommon
import SparkCore
import UIKit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

import Combine
import SparkCore
import Spark
import UIKit
@_spi(SI_SPI) import SparkCommon

final class CheckboxGroupComponentUIView: ComponentUIView {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
//

import Combine
import Spark
import SparkCore
import SwiftUI
import UIKit
@_spi(SI_SPI) import SparkCommon

final class CheckboxGroupComponentUIViewController: UIViewController {

Expand Down Expand Up @@ -51,11 +51,11 @@ final class CheckboxGroupComponentUIViewController: UIViewController {

self.themePublisher
.$theme
.sink(receiveValue: { [weak self] theme in
.sink { [weak self] theme in
guard let self = self else { return }
self.viewModel.theme = theme
self.navigationController?.navigationBar.tintColor = theme.colors.main.main.uiColor
})
}
.store(in: &self.cancellables)

self.viewModel.showThemeSheet.subscribe(in: &self.cancellables) { intents in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

import Combine
import Spark
@_spi(SI_SPI) import SparkCommon
import SparkCore
import UIKit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2023 Adevinta. All rights reserved.
//

import Spark
@_spi(SI_SPI) import SparkCommon
import SparkCore
import SwiftUI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

import Combine
import Spark
import SparkCore
import SwiftUI

Expand Down
Loading
Loading