Skip to content

Commit c24d891

Browse files
committed
chore(ios): remove swiftlint
1 parent a796d5d commit c24d891

7 files changed

Lines changed: 50 additions & 74 deletions

File tree

.github/workflows/pull_request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ jobs:
3737
- name: Generate nitrogen code
3838
run: yarn nitrogen
3939

40-
- name: Install ktlint & swiftlint
40+
- name: Install ktlint & swiftformat
4141
run: |
4242
brew install ktlint
43-
brew install swiftlint
43+
brew install swiftformat
4444
4545
- name: Lint files
4646
run: yarn lint

ios/.swiftformat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
--wrap-return-type never
1717
--disable wrapMultilineStatementBraces
1818

19-
--rules indent,braces,spaceInsideParens,spaceInsideBraces,spaceAroundOperators
19+
--rules indent,braces,spaceInsideParens,spaceInsideBraces,spaceAroundOperators,consecutiveSpaces,trailingSpace
2020

21-
--trim-whitespace nonblank-lines
21+
--trim-whitespace always
2222
--linebreaks lf

ios/.swiftlint.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

ios/RNGoogleMapsPlusStreetView.swift

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import GoogleMaps
44
import NitroModules
55

66
final class RNGoogleMapsPlusStreetView: HybridRNGoogleMapsPlusStreetViewSpec {
7-
7+
88
private let mapErrorHandler: MapErrorHandler
99
private let permissionHandler: PermissionHandler
1010
private let locationHandler: LocationHandler
1111
private let impl: StreetViewPanoramaViewImpl
12-
12+
1313
var view: UIView {
1414
return impl
1515
}
16-
16+
1717
override init() {
1818
self.permissionHandler = PermissionHandler()
1919
self.locationHandler = LocationHandler()
@@ -23,18 +23,19 @@ final class RNGoogleMapsPlusStreetView: HybridRNGoogleMapsPlusStreetViewSpec {
2323
locationHandler: locationHandler
2424
)
2525
}
26-
26+
2727
func onDropView() {
2828
impl.deinitInternal()
2929
}
30-
30+
3131
var initialProps: RNStreetViewInitialProps? {
3232
didSet { impl.streetViewInitialProps = initialProps }
3333
}
34-
34+
3535
var uiSettings: RNStreetViewUiSettings? {
3636
didSet { impl.uiSettings = uiSettings }
3737
}
38+
3839
var onPanoramaReady: ((Bool) -> Void)? {
3940
didSet { impl.onPanoramaReady = onPanoramaReady }
4041
}
@@ -56,38 +57,38 @@ final class RNGoogleMapsPlusStreetView: HybridRNGoogleMapsPlusStreetViewSpec {
5657
var onPanoramaError: ((RNMapErrorCode, String) -> Void)? {
5758
didSet { mapErrorHandler.callback = onPanoramaError }
5859
}
59-
60+
6061
func setCamera(camera: RNStreetViewCamera, animated: Bool?, durationMs: Double?) {
6162
onMain {
6263
let cam = camera.toGMSPanoramaCamera(current: self.impl.currentCamera)
6364
self.impl.setCamera(cam, animated: animated ?? false, durationMs: durationMs ?? 1000)
6465
}
6566
}
66-
67+
6768
func setPosition(position: RNLatLng, radius: Double?, source: RNStreetViewSource?) {
6869
impl.setPosition(
6970
position.toCLLocationCoordinate2D(),
7071
radius: radius.map { UInt($0) },
7172
source: source?.toGMSPanoramaSource ?? .default
7273
)
7374
}
74-
75+
7576
func setPositionById(panoramaId: String) {
7677
impl.setPositionById(panoramaId)
7778
}
78-
79+
7980
func showLocationDialog() {
8081
locationHandler.showLocationDialog()
8182
}
82-
83+
8384
func openLocationSettings() {
8485
locationHandler.openLocationSettings()
8586
}
86-
87+
8788
func requestLocationPermission() -> NitroModules.Promise<RNLocationPermissionResult> {
8889
return permissionHandler.requestLocationPermission()
8990
}
90-
91+
9192
func isGooglePlayServicesAvailable() -> Bool {
9293
return false
9394
}

ios/StreetViewPanoramaViewImpl.swift

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import NitroModules
44
import UIKit
55

66
final class StreetViewPanoramaViewImpl: UIView, GMSPanoramaViewDelegate {
7-
7+
88
private let mapErrorHandler: MapErrorHandler
99
private let locationHandler: LocationHandler
1010
private var panoramaView: GMSPanoramaView?
1111
private var panoramaViewInitialized = false
1212
private var deInitialized = false
13-
13+
1414
init(
1515
frame: CGRect = .zero,
1616
mapErrorHandler: MapErrorHandler,
@@ -20,10 +20,10 @@ final class StreetViewPanoramaViewImpl: UIView, GMSPanoramaViewDelegate {
2020
self.locationHandler = locationHandler
2121
super.init(frame: frame)
2222
}
23-
23+
2424
private var lifecycleAttached = false
2525
private var lifecycleTasks = [Task<Void, Never>]()
26-
26+
2727
private func attachLifecycleObservers() {
2828
if lifecycleAttached { return }
2929
lifecycleAttached = true
@@ -46,23 +46,23 @@ final class StreetViewPanoramaViewImpl: UIView, GMSPanoramaViewDelegate {
4646
}
4747
)
4848
}
49-
49+
5050
private func detachLifecycleObservers() {
5151
if !lifecycleAttached { return }
5252
lifecycleAttached = false
5353
lifecycleTasks.forEach { $0.cancel() }
5454
lifecycleTasks.removeAll()
5555
}
56-
56+
5757
required init?(coder: NSCoder) {
5858
fatalError("init(coder:) has not been implemented")
5959
}
60-
60+
6161
func initPanoramaView() {
6262
onMain {
6363
if self.panoramaViewInitialized { return }
6464
self.panoramaViewInitialized = true
65-
65+
6666
let props = self.streetViewInitialProps
6767
if let position = props?.position {
6868
let coordinate = position.toCLLocationCoordinate2D()
@@ -75,42 +75,42 @@ final class StreetViewPanoramaViewImpl: UIView, GMSPanoramaViewDelegate {
7575
} else {
7676
self.panoramaView = GMSPanoramaView(frame: self.bounds)
7777
}
78-
78+
7979
props?.panoramaId.map { self.panoramaView?.move(toPanoramaID: $0) }
8080
props?.camera.map { self.panoramaView?.camera = $0.toGMSPanoramaCamera() }
81-
81+
8282
self.panoramaView?.delegate = self
8383
self.panoramaView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
8484
self.panoramaView.map { self.addSubview($0) }
85-
85+
8686
self.applyProps()
8787
self.initLocationCallbacks()
8888
self.onPanoramaReady?(true)
8989
}
9090
}
91-
91+
9292
private func initLocationCallbacks() {
9393
locationHandler.onUpdate = { [weak self] loc in
9494
onMain { [weak self] in
9595
self?.onLocationUpdate?(loc.toRnLocation())
9696
}
9797
}
98-
98+
9999
locationHandler.onError = { [weak self] error in
100100
onMain { [weak self] in
101101
self?.onLocationError?(error)
102102
}
103103
}
104104
}
105-
105+
106106
private func applyProps() {
107107
({ self.uiSettings = self.uiSettings })()
108108
}
109-
109+
110110
var currentCamera: GMSPanoramaCamera? { panoramaView?.camera }
111-
111+
112112
var streetViewInitialProps: RNStreetViewInitialProps?
113-
113+
114114
var uiSettings: RNStreetViewUiSettings? {
115115
didSet {
116116
onMain {
@@ -121,14 +121,14 @@ final class StreetViewPanoramaViewImpl: UIView, GMSPanoramaViewDelegate {
121121
}
122122
}
123123
}
124-
124+
125125
var onPanoramaReady: ((Bool) -> Void)?
126126
var onLocationUpdate: ((RNLocation) -> Void)?
127127
var onLocationError: ((RNLocationErrorCode) -> Void)?
128128
var onPanoramaChange: ((RNStreetViewPanoramaLocation) -> Void)?
129129
var onCameraChange: ((RNStreetViewCamera) -> Void)?
130130
var onPanoramaPress: ((RNStreetViewOrientation) -> Void)?
131-
131+
132132
func setCamera(_ camera: GMSPanoramaCamera, animated: Bool, durationMs: Double) {
133133
onMain {
134134
if animated {
@@ -140,7 +140,7 @@ final class StreetViewPanoramaViewImpl: UIView, GMSPanoramaViewDelegate {
140140
}
141141
}
142142
}
143-
143+
144144
func setPosition(_ coordinate: CLLocationCoordinate2D, radius: UInt?, source: GMSPanoramaSource) {
145145
onMain {
146146
if let radius {
@@ -150,13 +150,13 @@ final class StreetViewPanoramaViewImpl: UIView, GMSPanoramaViewDelegate {
150150
}
151151
}
152152
}
153-
153+
154154
func setPositionById(_ panoramaId: String) {
155155
onMain {
156156
self.panoramaView?.move(toPanoramaID: panoramaId)
157157
}
158158
}
159-
159+
160160
func deinitInternal() {
161161
guard !deInitialized else { return }
162162
deInitialized = true
@@ -167,17 +167,17 @@ final class StreetViewPanoramaViewImpl: UIView, GMSPanoramaViewDelegate {
167167
self.panoramaView = nil
168168
}
169169
}
170-
170+
171171
private func appDidBecomeActive() {
172172
if window != nil {
173173
locationHandler.start()
174174
}
175175
}
176-
176+
177177
private func appDidEnterBackground() {
178178
locationHandler.stop()
179179
}
180-
180+
181181
override func didMoveToWindow() {
182182
super.didMoveToWindow()
183183
if window != nil {
@@ -189,11 +189,11 @@ final class StreetViewPanoramaViewImpl: UIView, GMSPanoramaViewDelegate {
189189
detachLifecycleObservers()
190190
}
191191
}
192-
192+
193193
deinit {
194194
deinitInternal()
195195
}
196-
196+
197197
func panoramaView(_ panoramaView: GMSPanoramaView, didMoveTo panorama: GMSPanorama?) {
198198
onMain {
199199
guard let panorama else { return }
@@ -209,15 +209,15 @@ final class StreetViewPanoramaViewImpl: UIView, GMSPanoramaViewDelegate {
209209
)
210210
}
211211
}
212-
212+
213213
func panoramaView(_ panoramaView: GMSPanoramaView, error: Error, onMoveNearCoordinate coordinate: CLLocationCoordinate2D) {
214214
mapErrorHandler.report(.panoramaNotFound, error.localizedDescription, error)
215215
}
216-
216+
217217
func panoramaView(_ panoramaView: GMSPanoramaView, error: Error, onMoveToPanoramaID panoramaID: String) {
218218
mapErrorHandler.report(.panoramaNotFound, error.localizedDescription, error)
219219
}
220-
220+
221221
func panoramaView(_ panoramaView: GMSPanoramaView, didMove camera: GMSPanoramaCamera) {
222222
onMain {
223223
self.onCameraChange?(
@@ -229,7 +229,7 @@ final class StreetViewPanoramaViewImpl: UIView, GMSPanoramaViewDelegate {
229229
)
230230
}
231231
}
232-
232+
233233
func panoramaView(_ panoramaView: GMSPanoramaView, didTap point: CGPoint) {
234234
onMain {
235235
let orientation = panoramaView.orientation(for: point)

ios/extensions/String+Extensions.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ extension UIColor {
8787
let x = c * (1 - Swift.abs((h / 60).truncatingRemainder(dividingBy: 2) - 1))
8888
let m = l - c / 2
8989

90-
// swiftlint:disable:next large_tuple
9190
let (r1, g1, b1): (Double, Double, Double)
9291
switch h {
9392
case 0 ..< 60: (r1, g1, b1) = (c, x, 0)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"lint": "yarn lint:js && yarn lint:android && yarn lint:ios",
1616
"lint:js": "eslint . --max-warnings 0 && yarn prettier --check .",
1717
"lint:android": "cd android && ktlint -F ./**/*.kt*",
18-
"lint:ios": "cd ios && swiftlint --quiet && swiftformat . --lint",
18+
"lint:ios": "cd ios && swiftformat . --lint",
1919
"format": "yarn format:js && yarn format:ios && yarn format:android",
2020
"format:js": "eslint . --fix && prettier --write .",
2121
"format:android": "cd android && ktlint --format ./**/*.kt*",

0 commit comments

Comments
 (0)