Skip to content
Open
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
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 79 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/Viperit.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1640"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Viperit"
BuildableName = "Viperit"
BlueprintName = "Viperit"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ViperitTests"
BuildableName = "ViperitTests"
BlueprintName = "ViperitTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Viperit"
BuildableName = "Viperit"
BlueprintName = "Viperit"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
2 changes: 1 addition & 1 deletion Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit
import Viperit

@UIApplicationMain
@main
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?
Expand Down
1 change: 1 addition & 0 deletions Example/modules/Home/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Viperit


//MARK: - Public Interface Protocol
@MainActor
protocol HomeViewInterface {
func showLoading()
func showInfo(message: String)
Expand Down
44 changes: 26 additions & 18 deletions ExampleTests/HomeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,46 @@ class HomeMockView: UserInterface, HomeViewInterface {
}
}

class HomeTests: XCTestCase {

var view: HomeMockView!
var presenter: HomePresenter!

override func setUp() {
super.setUp()
struct HomeMockModuleComponents {
let view: HomeMockView
let presenter: HomePresenter
}

@MainActor
class HomeTests: XCTestCase, Sendable {

private(set) var mockModuleComponents: HomeMockModuleComponents!

override func setUp() async throws {
try await super.setUp()
await buildMockComponents()
}

private func buildMockComponents() async {
var mod = AppModules.home.build()
view = HomeMockView()
view.expectation = expectation(description: "Test expectation description")
presenter = mod.presenter as? HomePresenter
mod.injectMock(view: view)
mockModuleComponents = .init(view: HomeMockView(), presenter: (mod.presenter as? HomePresenter)!)
mockModuleComponents.view.expectation = expectation(description: "Test expectation description")
mod.injectMock(view: mockModuleComponents.view)
}

func expect(timeout: TimeInterval = 5, errorMessage: String = "TIMEOUT") {
waitForExpectations(timeout: 5) { error in
guard error != nil else { return }
XCTFail(errorMessage)
}
}

func testShowInfo1() {
print("---RUNNING TEST1---")
view.expectedMessage = "CONTENT_LOADED"
presenter.loadContent()
mockModuleComponents.view.expectedMessage = "CONTENT_LOADED"
mockModuleComponents.presenter.loadContent()
expect()
}

func testShowInfo2() {
print("---RUNNING TEST2---")
view.expectedMessage = "CONTENT_LOADED"
presenter.loadContent()
mockModuleComponents.view.expectedMessage = "CONTENT_LOADED"
mockModuleComponents.presenter.loadContent()
expect()
}
}
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// swift-tools-version:5.0
// swift-tools-version:6.0
import PackageDescription

let package = Package(
name: "Viperit",
platforms: [.iOS("11.0")],
platforms: [.iOS("12.0")],
products: [
.library(name: "Viperit", targets: ["Viperit"])
],
Expand Down
2 changes: 1 addition & 1 deletion Viperit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Viper Framework for iOS to implement VIPER architecture in an easy way
s.source = { :git => 'https://github.com/ferranabello/Viperit.git', :tag => s.version.to_s }
s.weak_framework = 'SwiftUI'
s.social_media_url = 'https://twitter.com/acferran'
s.swift_version = '5'
s.swift_version = '6'

s.ios.deployment_target = '12.0'
s.source_files = 'Viperit/**/*.swift'
Expand Down
Loading