Skip to content

Commit

Permalink
Merge pull request #185 from Subito-it/feature/remove_by_stub
Browse files Browse the repository at this point in the history
Remove requests by SBTRequestMatch
  • Loading branch information
tcamin authored Sep 13, 2023
2 parents 5af2333 + 2c85ec3 commit 49fe753
Show file tree
Hide file tree
Showing 37 changed files with 1,071 additions and 835 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ jobs:
fail-fast: false
matrix:
include:
- ios: "15.5"
os: "macos-12"
xcode: "13.4.1"
- ios: "16.2"
os: "macos-latest"
xcode: "14.2"
Expand Down
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.8
39 changes: 39 additions & 0 deletions .swiftformat.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
--allman false
--binarygrouping none
--closingparen balanced
--commas inline
--conflictmarkers reject
--decimalgrouping 3,4
--elseposition same-line
--guardelse auto
--empty void
--exponentcase lowercase
--exponentgrouping disabled
--fractiongrouping disabled
--fragment false
--header ignore
--hexgrouping none
--hexliteralcase uppercase
--ifdef indent
--importgrouping alphabetized
--indent 4
--indentcase false
--linebreaks lf
--octalgrouping none
--operatorfunc spaced
--patternlet hoist
--nospaceoperators
--self init-only
--selfrequired
--semicolons inline
--stripunusedargs closure-only
--trailingclosures
--trimwhitespace nonblank-lines
--wraparguments preserve
--wrapcollections preserve
--modifierorder public,override
--xcodeindentation enabled
--disable redundantObjc,wrapMultilineStatementBraces

--exclude Pods
--exclude Modules/External
36 changes: 16 additions & 20 deletions Example/SBTUITestTunnel/SBTExtensionCollectionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@
import UIKit

class SBTExtensionCollectionViewController: UIViewController {

private let scrollDirection: UICollectionView.ScrollDirection
private let flowLayout: UICollectionViewFlowLayout
private let collectionView: UICollectionView

init(scrollDirection: UICollectionView.ScrollDirection) {
self.scrollDirection = scrollDirection

self.flowLayout = UICollectionViewFlowLayout()
self.flowLayout.scrollDirection = scrollDirection
flowLayout = UICollectionViewFlowLayout()
flowLayout.scrollDirection = scrollDirection

self.collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
self.collectionView.backgroundColor = .green
collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectionView.backgroundColor = .green

self.collectionView.contentInsetAdjustmentBehavior = .always
self.collectionView.translatesAutoresizingMaskIntoConstraints = false
self.collectionView.contentInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
self.collectionView.register(Cell.self, forCellWithReuseIdentifier: "cell")
self.collectionView.accessibilityIdentifier = "collection"
self.collectionView.translatesAutoresizingMaskIntoConstraints = false
collectionView.contentInsetAdjustmentBehavior = .always
collectionView.translatesAutoresizingMaskIntoConstraints = false
collectionView.contentInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
collectionView.register(Cell.self, forCellWithReuseIdentifier: "cell")
collectionView.accessibilityIdentifier = "collection"
collectionView.translatesAutoresizingMaskIntoConstraints = false

super.init(nibName: nil, bundle: nil)
}

required init?(coder: NSCoder) {
@available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand All @@ -59,12 +59,11 @@ class SBTExtensionCollectionViewController: UIViewController {
}

extension SBTExtensionCollectionViewController: UICollectionViewDataSource {

func numberOfSections(in collectionView: UICollectionView) -> Int {
func numberOfSections(in _: UICollectionView) -> Int {
return 1
}

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
func collectionView(_: UICollectionView, numberOfItemsInSection _: Int) -> Int {
return 100
}

Expand All @@ -78,8 +77,7 @@ extension SBTExtensionCollectionViewController: UICollectionViewDataSource {
}

extension SBTExtensionCollectionViewController: UICollectionViewDelegateFlowLayout {
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {

public func collectionView(_ collectionView: UICollectionView, layout _: UICollectionViewLayout, sizeForItemAt _: IndexPath) -> CGSize {
if scrollDirection == .vertical {
return CGSize(width: collectionView.frame.width, height: 100)
} else {
Expand All @@ -89,7 +87,6 @@ extension SBTExtensionCollectionViewController: UICollectionViewDelegateFlowLayo
}

private final class Cell: UICollectionViewCell {

let label = UILabel()

override init(frame: CGRect) {
Expand All @@ -113,7 +110,7 @@ private final class Cell: UICollectionViewCell {
label.topAnchor.constraint(equalTo: contentView.topAnchor),
label.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
label.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
label.trailingAnchor.constraint(equalTo: contentView.trailingAnchor)
label.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
])
}

Expand All @@ -122,4 +119,3 @@ private final class Cell: UICollectionViewCell {
accessibilityIdentifier = text
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import UIKit
import CoreLocation
import UIKit

class SBTExtensionCoreLocationViewController: UIViewController, CLLocationManagerDelegate {

private let authorizationButton = UIButton()
private let updateLocationButton = UIButton()
private let stopLocationUpdateButton = UIButton()
Expand Down Expand Up @@ -50,7 +49,7 @@ class SBTExtensionCoreLocationViewController: UIViewController, CLLocationManage
locationThreadLabel.text = "-"
locationThreadLabel.textColor = .black
locationThreadLabel.accessibilityIdentifier = "location_thread"

currentLocationLabel.text = "-"
currentLocationLabel.textColor = .black
currentLocationLabel.accessibilityIdentifier = "manager_location"
Expand Down Expand Up @@ -84,29 +83,29 @@ class SBTExtensionCoreLocationViewController: UIViewController, CLLocationManage
NSLayoutConstraint.activate([
contentStack.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 16),
contentStack.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 16),
contentStack.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -16)
contentStack.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -16),
])

locationManager.delegate = self
}

@objc func updateTapped(_ sender: Any) {
@objc func updateTapped(_: Any) {
locationManager.startUpdatingLocation()
}

@objc func stopTapped(_ sender: Any) {
@objc func stopTapped(_: Any) {
locationManager.stopUpdatingLocation()
}

@objc func authorizationStatusTapped(_ sender: Any) {
@objc func authorizationStatusTapped(_: Any) {
if #available(iOS 14.0, *) {
statusLabel.text = "\(locationManager.authorizationStatus.description)"
} else {
statusLabel.text = "\(CLLocationManager.authorizationStatus().description)"
}
}
@objc func currentLocationTapped(_ sender: Any) {

@objc func currentLocationTapped(_: Any) {
if let location = locationManager.location {
currentLocationLabel.text = "\(location.coordinate.latitude) \(location.coordinate.longitude)"
} else {
Expand All @@ -127,7 +126,7 @@ extension SBTExtensionCoreLocationViewController {
}

extension SBTExtensionCoreLocationViewController {
func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
func locationManager(_: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
let threadName = Thread.isMainThread ? "Main" : "Not main"
if #unavailable(iOS 14.0) {
DispatchQueue.main.async { [weak self] in
Expand All @@ -139,7 +138,7 @@ extension SBTExtensionCoreLocationViewController {
}

extension SBTExtensionCoreLocationViewController {
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
func locationManager(_: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let threadName = Thread.isMainThread ? "Main" : "Not main"
DispatchQueue.main.async { [weak self] in
self?.locationLabel.text = locations.map { "\($0.coordinate.latitude) \($0.coordinate.longitude)" }.joined(separator: "+")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import UIKit
class SBTExtensionTableViewController1: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()

tableView.accessibilityIdentifier = "table"
}
}
22 changes: 11 additions & 11 deletions Example/SBTUITestTunnel/SBTExtensionTableViewController2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ import UIKit
class SBTExtensionTableViewController2: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()

tableView.accessibilityIdentifier = "table"

tableView.rowHeight = 150
}

// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {

override func numberOfSections(in _: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

override func tableView(_: UITableView, numberOfRowsInSection _: Int) -> Int {
return 100
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

override func tableView(_: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: .default, reuseIdentifier: "reuseIdentifier")

cell.textLabel?.text = "\(indexPath.row)"

return cell
}
}
4 changes: 2 additions & 2 deletions Example/SBTUITestTunnel/SBTNetworkTestViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import UIKit
class SBTNetworkTestViewController: UIViewController {
@IBOutlet var networkResult: UITextView!
var networkResultString: String = ""

override func viewDidLoad() {
super.viewDidLoad()

networkResult.text = networkResultString
}
}
Loading

0 comments on commit 49fe753

Please sign in to comment.