Skip to content

Commit cc8ff7d

Browse files
committed
rename sample classes to adhere to swift convention
1 parent cd8f29b commit cc8ff7d

File tree

7 files changed

+33
-33
lines changed

7 files changed

+33
-33
lines changed

samples/swift/FirebaseUI-demo-swift/Base.lproj/Main.storyboard

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<!--Samples View Controller-->
1111
<scene sceneID="tne-QT-ifu">
1212
<objects>
13-
<viewController automaticallyAdjustsScrollViewInsets="NO" id="BYZ-38-t0r" customClass="FIRSamplesViewController" customModule="FirebaseUI_demo_swift" customModuleProvider="target" sceneMemberID="viewController">
13+
<viewController automaticallyAdjustsScrollViewInsets="NO" id="BYZ-38-t0r" customClass="SamplesViewController" customModule="FirebaseUI_demo_swift" customModuleProvider="target" sceneMemberID="viewController">
1414
<layoutGuides>
1515
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
1616
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
@@ -22,7 +22,7 @@
2222
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="60" sectionHeaderHeight="1" sectionFooterHeight="1" translatesAutoresizingMaskIntoConstraints="NO" id="EMf-5k-tRY">
2323
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2424
<prototypes>
25-
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="FIRSamplesViewControllerCell" id="mwf-Pe-7Xw" customClass="FIRSampleCell" customModule="FirebaseUI_demo_swift">
25+
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SamplesViewControllerCell" id="mwf-Pe-7Xw" customClass="SampleCell" customModule="FirebaseUI_demo_swift">
2626
<rect key="frame" x="0.0" y="1" width="375" height="60"/>
2727
<autoresizingMask key="autoresizingMask"/>
2828
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="mwf-Pe-7Xw" id="su3-0f-Qc4">
@@ -78,7 +78,7 @@
7878
<!--Chat View Controller-->
7979
<scene sceneID="JRY-Ou-cBR">
8080
<objects>
81-
<viewController storyboardIdentifier="FIRChatViewController" id="DlP-uj-LdB" customClass="FIRChatViewController" customModule="FirebaseUI_demo_swift" customModuleProvider="target" sceneMemberID="viewController">
81+
<viewController storyboardIdentifier="ChatViewController" id="DlP-uj-LdB" customClass="ChatViewController" customModule="FirebaseUI_demo_swift" customModuleProvider="target" sceneMemberID="viewController">
8282
<layoutGuides>
8383
<viewControllerLayoutGuide type="top" id="Hrd-jq-l3U"/>
8484
<viewControllerLayoutGuide type="bottom" id="CT4-Lk-WT2"/>
@@ -95,7 +95,7 @@
9595
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
9696
</collectionViewFlowLayout>
9797
<cells>
98-
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="FIRChatCollectionViewCell" id="Wc2-OF-raU" customClass="FIRChatCollectionViewCell" customModule="FirebaseUI_demo_swift" customModuleProvider="target">
98+
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="ChatCollectionViewCell" id="Wc2-OF-raU" customClass="ChatCollectionViewCell" customModule="FirebaseUI_demo_swift" customModuleProvider="target">
9999
<rect key="frame" x="87" y="0.0" width="202" height="130"/>
100100
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
101101
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
@@ -433,7 +433,7 @@
433433
<!--Storage View Controller-->
434434
<scene sceneID="AUm-G9-f66">
435435
<objects>
436-
<viewController storyboardIdentifier="FIRStorageViewController" title="Storage View Controller" id="WET-Ai-gqs" customClass="FIRStorageViewController" customModule="FirebaseUI_demo_swift" customModuleProvider="target" sceneMemberID="viewController">
436+
<viewController storyboardIdentifier="StorageViewController" title="Storage View Controller" id="WET-Ai-gqs" customClass="StorageViewController" customModule="FirebaseUI_demo_swift" customModuleProvider="target" sceneMemberID="viewController">
437437
<layoutGuides>
438438
<viewControllerLayoutGuide type="top" id="fLb-ZX-Bfw"/>
439439
<viewControllerLayoutGuide type="bottom" id="l9a-lf-5Sv"/>

samples/swift/FirebaseUI-demo-swift/Samples/Chat/FIRChatCollectionViewCell.swift renamed to samples/swift/FirebaseUI-demo-swift/Samples/Chat/ChatCollectionViewCell.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
import UIKit
1818
import Firebase
1919

20-
/// Displays an individual chat message inside of a FIRChatViewController.
21-
class FIRChatCollectionViewCell: UICollectionViewCell {
20+
/// Displays an individual chat message inside of a ChatViewController.
21+
class ChatCollectionViewCell: UICollectionViewCell {
2222
@IBOutlet fileprivate(set) var textLabel: UILabel! {
2323
didSet {
24-
textLabel.font = FIRChatCollectionViewCell.messageFont
24+
textLabel.font = ChatCollectionViewCell.messageFont
2525
}
2626
}
2727

2828
static func boundingRectForText(_ text: String, maxWidth: CGFloat) -> CGRect {
29-
let attributes = [NSFontAttributeName: FIRChatCollectionViewCell.messageFont]
29+
let attributes = [NSFontAttributeName: ChatCollectionViewCell.messageFont]
3030
let rect = text.boundingRect(with: CGSize(width: maxWidth, height: CGFloat.greatestFiniteMagnitude),
3131
options: [.usesLineFragmentOrigin],
3232
attributes: attributes,
@@ -76,19 +76,19 @@ class FIRChatCollectionViewCell: UICollectionViewCell {
7676
self.textLabel.text = chat.text
7777

7878
let leftRightPadding: CGFloat = 24
79-
let rect = FIRChatCollectionViewCell.boundingRectForText(self.textLabel.text!,
79+
let rect = ChatCollectionViewCell.boundingRectForText(self.textLabel.text!,
8080
maxWidth: maxWidth)
8181

8282
let constant = max(maxWidth - rect.size.width - leftRightPadding, CGFloat.leastNormalMagnitude)
8383
if chat.uid == user?.uid ?? "" {
84-
let colors = FIRChatCollectionViewCell.selfColors
84+
let colors = ChatCollectionViewCell.selfColors
8585
self.containerView.backgroundColor = colors.background
8686
self.textLabel.textColor = colors.text
8787
self.trailingConstraint.isActive = false
8888
self.leadingConstraint.constant = constant
8989
self.leadingConstraint.isActive = true
9090
} else {
91-
let colors = FIRChatCollectionViewCell.othersColors
91+
let colors = ChatCollectionViewCell.othersColors
9292
self.containerView.backgroundColor = colors.background
9393
self.textLabel.textColor = colors.text
9494
self.leadingConstraint.isActive = false

samples/swift/FirebaseUI-demo-swift/Samples/Chat/FIRChatViewController.swift renamed to samples/swift/FirebaseUI-demo-swift/Samples/Chat/ChatViewController.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ import FirebaseAuthUI
2222
/// View controller demonstrating using a FUICollectionViewDataSource
2323
/// to populate a collection view with chat messages. The relevant code
2424
/// is in the call to `collectionViewDataSource.populateCellWithBlock`.
25-
class FIRChatViewController: UIViewController, UICollectionViewDelegateFlowLayout {
25+
class ChatViewController: UIViewController, UICollectionViewDelegateFlowLayout {
2626
// All of the error handling in this controller is done with `fatalError`;
2727
// please don't copy paste it into your production code.
2828

29-
fileprivate static let reuseIdentifier = "FIRChatCollectionViewCell"
29+
fileprivate static let reuseIdentifier = "ChatCollectionViewCell"
3030

3131
@IBOutlet fileprivate var collectionView: UICollectionView!
3232
@IBOutlet fileprivate var textView: UITextView! {
@@ -65,8 +65,8 @@ class FIRChatViewController: UIViewController, UICollectionViewDelegateFlowLayou
6565
FUICollectionViewDataSource(query: self.query!,
6666
view: self.collectionView,
6767
populateCell: { (view, indexPath, snap) -> UICollectionViewCell in
68-
let cell = view.dequeueReusableCell(withReuseIdentifier: FIRChatViewController.reuseIdentifier,
69-
for: indexPath) as! FIRChatCollectionViewCell
68+
let cell = view.dequeueReusableCell(withReuseIdentifier: ChatViewController.reuseIdentifier,
69+
for: indexPath) as! ChatCollectionViewCell
7070
let chat = Chat(snapshot: snap)!
7171
cell.populateCellWithChat(chat, user: self.user, maxWidth: self.view.frame.size.width)
7272
return cell
@@ -79,7 +79,7 @@ class FIRChatViewController: UIViewController, UICollectionViewDelegateFlowLayou
7979
// on new insertions we still need to use the query directly.
8080
self.query!.observe(.childAdded, with: { [unowned self] _ in
8181
self.scrollToBottom(animated: true)
82-
})
82+
})
8383
}
8484

8585
self.auth?.signInAnonymously { (user, error) in
@@ -189,7 +189,7 @@ class FIRChatViewController: UIViewController, UICollectionViewDelegateFlowLayou
189189
let blob = self.collectionViewDataSource.object(at: UInt((indexPath as NSIndexPath).row)) as! FIRDataSnapshot
190190
let text = Chat(snapshot: blob)!.text
191191

192-
let rect = FIRChatCollectionViewCell.boundingRectForText(text, maxWidth: width)
192+
let rect = ChatCollectionViewCell.boundingRectForText(text, maxWidth: width)
193193

194194
let height = CGFloat(ceil(Double(rect.size.height))) + heightPadding
195195
return CGSize(width: width, height: height)

samples/swift/FirebaseUI-demo-swift/Samples/FIRSample.swift renamed to samples/swift/FirebaseUI-demo-swift/Samples/Sample.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
import UIKit
1818

1919
// This enum represents the samples that this app knows about, and
20-
// is used by the FIRSamplesViewController to layout all of the samples
20+
// is used by the SamplesViewController to layout all of the samples
2121
// and display basic information about them.
22-
enum FIRSample: Int, RawRepresentable {
22+
enum Sample: Int, RawRepresentable {
2323

2424
// When adding new samples, add a new value here and fill
2525
// out the switch statements below as necessary.
@@ -29,7 +29,7 @@ enum FIRSample: Int, RawRepresentable {
2929

3030
static var total: Int {
3131
var count = 0
32-
while let _ = FIRSample(rawValue: count) {
32+
while let _ = Sample(rawValue: count) {
3333
count += 1
3434
}
3535
return count
@@ -58,11 +58,11 @@ enum FIRSample: Int, RawRepresentable {
5858
func controller() -> UIViewController {
5959
switch self {
6060
case .chat:
61-
return UIStoryboard.instantiateViewController("Main", identifier: "FIRChatViewController")
61+
return UIStoryboard.instantiateViewController("Main", identifier: "ChatViewController")
6262
case .auth:
6363
return UIStoryboard.instantiateViewController("Main", identifier: "FIRAuthViewController")
6464
case .storage:
65-
return UIStoryboard.instantiateViewController("Main", identifier: "FIRStorageViewController")
65+
return UIStoryboard.instantiateViewController("Main", identifier: "StorageViewController")
6666
}
6767
}
6868
}

samples/swift/FirebaseUI-demo-swift/Samples/FIRSampleCell.swift renamed to samples/swift/FirebaseUI-demo-swift/Samples/SampleCell.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import UIKit
1818

19-
class FIRSampleCell: UITableViewCell {
19+
class SampleCell: UITableViewCell {
2020

2121
@IBOutlet fileprivate var titleLabel: UILabel!
2222
@IBOutlet fileprivate var subtitleLabel: UILabel!
@@ -29,13 +29,13 @@ class FIRSampleCell: UITableViewCell {
2929
super.init(style: .default, reuseIdentifier: reuseIdentifier)
3030
}
3131

32-
convenience init(type: FIRSample, reuseIdentifier: String) {
32+
convenience init(type: Sample, reuseIdentifier: String) {
3333
self.init(reuseIdentifier: reuseIdentifier)
3434

3535
self.configureWithType(type)
3636
}
3737

38-
func configureWithType(_ type: FIRSample) {
38+
func configureWithType(_ type: Sample) {
3939
let labels = type.labels
4040
self.titleLabel.text = labels.title
4141
self.subtitleLabel.text = labels.subtitle

samples/swift/FirebaseUI-demo-swift/Samples/FIRSamplesViewController.swift renamed to samples/swift/FirebaseUI-demo-swift/Samples/SamplesViewController.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import UIKit
1919
// This controller exists solely to list the samples we've defined thus far.
2020
// Because all of that stuff is static and unchanging, if the app ever crashes
2121
// in here it's probably a typo or some other small accident.
22-
class FIRSamplesViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
22+
class SamplesViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
2323

24-
fileprivate let reuseIdentifier = "FIRSamplesViewControllerCell"
24+
fileprivate let reuseIdentifier = "SamplesViewControllerCell"
2525

2626
@IBOutlet fileprivate var tableView: UITableView!
2727

@@ -39,7 +39,7 @@ class FIRSamplesViewController: UIViewController, UITableViewDelegate, UITableVi
3939

4040
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
4141
let navController = self.navigationController! // assert nonnull
42-
let targetController = FIRSample(rawValue: (indexPath as NSIndexPath).row)!.controller()
42+
let targetController = Sample(rawValue: (indexPath as NSIndexPath).row)!.controller()
4343

4444
navController.pushViewController(targetController, animated: true)
4545
tableView.deselectRow(at: indexPath, animated: true)
@@ -48,16 +48,16 @@ class FIRSamplesViewController: UIViewController, UITableViewDelegate, UITableVi
4848
// MARK: - UITableView Data Source
4949

5050
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
51-
let sampleType = FIRSample(rawValue: (indexPath as NSIndexPath).row)!
51+
let sampleType = Sample(rawValue: (indexPath as NSIndexPath).row)!
5252

53-
let cell = self.tableView.dequeueReusableCell(withIdentifier: reuseIdentifier) as! FIRSampleCell
53+
let cell = self.tableView.dequeueReusableCell(withIdentifier: reuseIdentifier) as! SampleCell
5454

5555
cell.configureWithType(sampleType)
5656

5757
return cell
5858
}
5959

6060
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
61-
return FIRSample.total
61+
return Sample.total
6262
}
6363
}

samples/swift/FirebaseUI-demo-swift/Samples/FIRStorageViewController.swift renamed to samples/swift/FirebaseUI-demo-swift/Samples/StorageViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import UIKit
1818

1919
import FirebaseStorageUI
2020

21-
class FIRStorageViewController: UIViewController {
21+
class StorageViewController: UIViewController {
2222

2323
@IBOutlet fileprivate var imageView: UIImageView!
2424
@IBOutlet fileprivate var textField: UITextField!

0 commit comments

Comments
 (0)