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
21 changes: 20 additions & 1 deletion BackToBasicsUIKit/BackToBasicsUIKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
7C9655B4222D93FD00A0BA9C /* JsonPlaceholderNetworking.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C9655B3222D93FD00A0BA9C /* JsonPlaceholderNetworking.swift */; };
7C9655B7222D9B2400A0BA9C /* RyanCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C9655B5222D9B2400A0BA9C /* RyanCollectionViewCell.swift */; };
7C9655B8222D9B2400A0BA9C /* RyanCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7C9655B6222D9B2400A0BA9C /* RyanCollectionViewCell.xib */; };
B3BD50EE2297783D00572B21 /* JimmyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3BD50ED2297783D00572B21 /* JimmyViewController.swift */; };
B3BD50F022977B3100572B21 /* Jimmy.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B3BD50EF22977B3100572B21 /* Jimmy.storyboard */; };
B3BD50F222977B9C00572B21 /* JimmySecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3BD50F122977B9C00572B21 /* JimmySecondViewController.swift */; };
D3BEC0122231A83500DE4678 /* SpinnerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3BEC0102231A83500DE4678 /* SpinnerVC.swift */; };
D3BEC0132231A83500DE4678 /* SpinnerVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = D3BEC0112231A83500DE4678 /* SpinnerVC.xib */; };
D3BEC0152231BAF200DE4678 /* PresentationsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3BEC0142231BAF200DE4678 /* PresentationsVC.swift */; };
Expand Down Expand Up @@ -62,6 +65,9 @@
7C9655B3222D93FD00A0BA9C /* JsonPlaceholderNetworking.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JsonPlaceholderNetworking.swift; sourceTree = "<group>"; };
7C9655B5222D9B2400A0BA9C /* RyanCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RyanCollectionViewCell.swift; sourceTree = "<group>"; };
7C9655B6222D9B2400A0BA9C /* RyanCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = RyanCollectionViewCell.xib; sourceTree = "<group>"; };
B3BD50ED2297783D00572B21 /* JimmyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JimmyViewController.swift; sourceTree = "<group>"; };
B3BD50EF22977B3100572B21 /* Jimmy.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Jimmy.storyboard; sourceTree = "<group>"; };
B3BD50F122977B9C00572B21 /* JimmySecondViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JimmySecondViewController.swift; sourceTree = "<group>"; };
D3BEC0102231A83500DE4678 /* SpinnerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpinnerVC.swift; sourceTree = "<group>"; };
D3BEC0112231A83500DE4678 /* SpinnerVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SpinnerVC.xib; sourceTree = "<group>"; };
D3BEC0142231BAF200DE4678 /* PresentationsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PresentationsVC.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -139,6 +145,16 @@
path = Cell;
sourceTree = "<group>";
};
B3BD50EC2297775F00572B21 /* Jimmy */ = {
isa = PBXGroup;
children = (
B3BD50ED2297783D00572B21 /* JimmyViewController.swift */,
B3BD50EF22977B3100572B21 /* Jimmy.storyboard */,
B3BD50F122977B9C00572B21 /* JimmySecondViewController.swift */,
);
path = Jimmy;
sourceTree = "<group>";
};
EF8F5BE8221328F50017C9FF = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -171,6 +187,7 @@
EF8F5C08221329B50017C9FF /* Demo ViewControllers */ = {
isa = PBXGroup;
children = (
B3BD50EC2297775F00572B21 /* Jimmy */,
EF8F5C312213765F0017C9FF /* Alejo */,
EF8F5C32221376680017C9FF /* Chris */,
EF8F5C33221376710017C9FF /* Freddy */,
Expand Down Expand Up @@ -382,6 +399,7 @@
EF8F5C2022132A6D0017C9FF /* AlejoViewController.xib in Resources */,
EF8F5C1022132A250017C9FF /* FreddyViewController.xib in Resources */,
F6F83B192231904C00CFDF42 /* source.txt in Resources */,
B3BD50F022977B3100572B21 /* Jimmy.storyboard in Resources */,
3AA01B91222F91F3008A68D9 /* PauloTableViewCell.xib in Resources */,
EF8F5C3022136EA90017C9FF /* PauloViewController.xib in Resources */,
EF8F5C1422132A330017C9FF /* GioViewController.xib in Resources */,
Expand All @@ -405,7 +423,7 @@
3AA01B89222F8B74008A68D9 /* PauloHeaderView.swift in Sources */,
EF8F5C0B22132A190017C9FF /* ChrisViewController.swift in Sources */,
D3BEC0122231A83500DE4678 /* SpinnerVC.swift in Sources */,
EF8F5C1B22132A630017C9FF /* GianniniViewController.swift in Sources */,
B3BD50F222977B9C00572B21 /* JimmySecondViewController.swift in Sources */,
EF8F5C2722132CFB0017C9FF /* NilsonViewController.swift in Sources */,
EF8F5C2322132CEC0017C9FF /* IvanViewController.swift in Sources */,
3AA0B2AC223053CA0013C34C /* User.swift in Sources */,
Expand All @@ -426,6 +444,7 @@
F6F83B122231904C00CFDF42 /* ProgrammaticTextFieldViewController.swift in Sources */,
EFF5949C222F7C8C00142FEB /* PagedViewController.swift in Sources */,
EF8F5BF5221328F50017C9FF /* AppDelegate.swift in Sources */,
B3BD50EE2297783D00572B21 /* JimmyViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Jimmy View Controller-->
<scene sceneID="i6n-Jf-cUm">
<objects>
<viewController storyboardIdentifier="JimmyViewController" id="JQL-P8-rL1" customClass="JimmyViewController" customModule="BackToBasicsUIKit" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="2bV-vk-ILW">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9xb-bj-TfT">
<rect key="frame" x="0.0" y="424" width="414" height="48"/>
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="48" id="1hd-GI-YcB"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="30"/>
<state key="normal" title="Beam me up Scotty!">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="buttonPressed:" destination="JQL-P8-rL1" eventType="touchUpInside" id="bwV-ls-74l"/>
</connections>
</button>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="type something to beam up!" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Id6-G3-T4c">
<rect key="frame" x="20" y="314" width="374" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="9zj-IF-OEb"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="25"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ASx-aW-Sso">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to add leading/trailing constraints to avoid the text from disappearing off screen if the label contents are very long.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give it some constraints

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or better yet, get rid of the storyboard and do it programmatically. You can pair with @gionoa and he'll show you the ways of the force.

<rect key="frame" x="160" y="226" width="94" height="48"/>
<fontDescription key="fontDescription" type="system" pointSize="40"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" name="blue"/>
<constraints>
<constraint firstItem="ASx-aW-Sso" firstAttribute="centerX" secondItem="2bV-vk-ILW" secondAttribute="centerX" id="24y-0o-bVf"/>
<constraint firstItem="Id6-G3-T4c" firstAttribute="leading" secondItem="tyl-He-E4t" secondAttribute="leading" constant="20" id="2dK-7h-mbb"/>
<constraint firstItem="9xb-bj-TfT" firstAttribute="centerX" secondItem="2bV-vk-ILW" secondAttribute="centerX" id="8Ke-FD-cph"/>
<constraint firstItem="tyl-He-E4t" firstAttribute="trailing" secondItem="9xb-bj-TfT" secondAttribute="trailing" id="8RX-IK-yX0"/>
<constraint firstItem="9xb-bj-TfT" firstAttribute="leading" secondItem="tyl-He-E4t" secondAttribute="leading" id="NUq-0c-a4B"/>
<constraint firstItem="9xb-bj-TfT" firstAttribute="centerY" secondItem="2bV-vk-ILW" secondAttribute="centerY" id="UYx-u0-vgw"/>
<constraint firstItem="Id6-G3-T4c" firstAttribute="top" secondItem="ASx-aW-Sso" secondAttribute="bottom" constant="40" id="mXl-m9-Clu"/>
<constraint firstItem="tyl-He-E4t" firstAttribute="trailing" secondItem="Id6-G3-T4c" secondAttribute="trailing" constant="20" id="siA-cI-S5u"/>
<constraint firstItem="9xb-bj-TfT" firstAttribute="top" secondItem="Id6-G3-T4c" secondAttribute="bottom" constant="70" id="udW-Cb-MfP"/>
</constraints>
<viewLayoutGuide key="safeArea" id="tyl-He-E4t"/>
</view>
<connections>
<outlet property="label" destination="ASx-aW-Sso" id="HZ2-7F-AkD"/>
<outlet property="textField" destination="Id6-G3-T4c" id="cR4-5e-ySR"/>
<segue destination="8BQ-iN-CpD" kind="show" identifier="sendDataForwards" id="rFD-NF-eVe"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="JNV-LY-xwq" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-136.23188405797103" y="87.723214285714278"/>
</scene>
<!--Jimmy Second View Controller-->
<scene sceneID="lbN-gP-vOp">
<objects>
<viewController storyboardIdentifier="JimmySecondViewController" id="8BQ-iN-CpD" customClass="JimmySecondViewController" customModule="BackToBasicsUIKit" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="azh-A8-7oV">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="send something back!" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="HTX-5E-tPi">
<rect key="frame" x="20" y="314" width="374" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="GOe-UA-uFQ"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="25"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sQh-Fq-jF0">
<rect key="frame" x="160" y="226" width="94" height="48"/>
<fontDescription key="fontDescription" type="system" pointSize="40"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cM5-3S-kGk">
<rect key="frame" x="0.0" y="424" width="414" height="48"/>
<color key="backgroundColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="48" id="BTx-hH-HGq"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="30"/>
<state key="normal" title="Pass it back!">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="buttonPressed:" destination="JQL-P8-rL1" eventType="touchUpInside" id="Sck-QX-Ebq"/>
<action selector="passItBack:" destination="8BQ-iN-CpD" eventType="touchUpInside" id="EJW-bK-np7"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" name="purple"/>
<constraints>
<constraint firstItem="cM5-3S-kGk" firstAttribute="top" secondItem="HTX-5E-tPi" secondAttribute="bottom" constant="70" id="483-i9-3QK"/>
<constraint firstItem="cM5-3S-kGk" firstAttribute="leading" secondItem="tQo-rm-UpT" secondAttribute="leading" id="5mg-Pd-EAa"/>
<constraint firstItem="HTX-5E-tPi" firstAttribute="top" secondItem="sQh-Fq-jF0" secondAttribute="bottom" constant="40" id="85I-rH-Cxs"/>
<constraint firstItem="sQh-Fq-jF0" firstAttribute="centerX" secondItem="azh-A8-7oV" secondAttribute="centerX" id="FSy-Uf-dWc"/>
<constraint firstItem="cM5-3S-kGk" firstAttribute="centerY" secondItem="azh-A8-7oV" secondAttribute="centerY" id="NgY-Yt-SEY"/>
<constraint firstItem="tQo-rm-UpT" firstAttribute="trailing" secondItem="cM5-3S-kGk" secondAttribute="trailing" id="Njt-Fa-JAV"/>
<constraint firstItem="HTX-5E-tPi" firstAttribute="leading" secondItem="tQo-rm-UpT" secondAttribute="leading" constant="20" id="gFh-qQ-kmK"/>
<constraint firstItem="tQo-rm-UpT" firstAttribute="trailing" secondItem="HTX-5E-tPi" secondAttribute="trailing" constant="20" id="tO7-rY-lAi"/>
<constraint firstItem="cM5-3S-kGk" firstAttribute="centerX" secondItem="azh-A8-7oV" secondAttribute="centerX" id="zIK-52-VPr"/>
</constraints>
<viewLayoutGuide key="safeArea" id="tQo-rm-UpT"/>
</view>
<connections>
<outlet property="label" destination="sQh-Fq-jF0" id="vI3-27-Tua"/>
<outlet property="textField" destination="HTX-5E-tPi" id="sXC-Wh-Trr"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="nFt-Yi-1yd" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="633" y="88"/>
</scene>
</scenes>
<resources>
<namedColor name="blue">
<color red="0.20000000000000001" green="0.73333333333333328" blue="0.93333333333333335" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="purple">
<color red="0.73333333333333328" green="0.26666666666666666" blue="0.8666666666666667" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// JimmySecondViewController.swift
// BackToBasicsUIKit
//
// Created by Jimmy Gutierrez on 5/23/19.
// Copyright © 2019 SwiftMiami. All rights reserved.
//

import UIKit

protocol canRecieve {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Names of protocols, classes, structs, etc should all be capitalised. The name should also be descriptive, and spelled correctly (receive).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add that even then I find this name wrong. The typical naming convention for something like this is {name of the VC}Delegate. In this case it would be: protocol JimmySecondViewControllerDelegate: class {

While delegates use protocols they have a specific use case and conventions. When you work in teams following platform and community conventions is super important.

func dataRecieved(data: String)
Copy link
Member

@paulofierro paulofierro May 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function signature should also include the sender, so the delegate knows who called it:

func dataRecieved(from viewController: UIViewController, data: String)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that you (Jimmy) were trying to follow the protocol pattern of a capability but I think you should scrap this idea and think of it as a Delegate specific to JimmySecondViewController. Then the function should be a specific need of JimmySecondViewController to communicate to another object. Maybe func didEnterText(_ text: String).

}

class JimmySecondViewController: UIViewController {

var delegate : canRecieve?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me introduce you to memory leaks. Let me know if you see why you have memory leak here and how you'd fix it.

Also the space should only go after the :. Like this:

Suggested change
var delegate : canRecieve?
var delegate: canRecieve?


var data = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming to initialData may make it a little clearer what the role of this variable is.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always important for names to make sense.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also go further and add that using the noun data makes this too generic. This is text we're talking here, it's a very specific type of data. The name should reflect not only in its use case but also its identity.


@IBOutlet var label: UILabel!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IBOutlets should be declared as private (we don't want outsiders to modify them) and weak.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Private makes sense. @ivancr regarding this, should IBOutlets be weak or strong, and why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically VC is not the owner of the label, the VC's view is and the VC already has a strong reference to its view.

If the VC also kept strong references to the view's children (e.g. this label) then those won't be deallocated if the view was to get swapped out. There may be use cases where you'd want a strong outlet, but I haven't run into one yet. YMMV 😃

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apple recommends that in the ARC age your IBOutlets should be strong:
https://stackoverflow.com/questions/7678469/should-iboutlets-be-strong-or-weak-under-arc

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ivancr i watched that session and was curious as to why they said that, as their documentation, Xcode defaults and sample code reflects the opposite.

I like this roundup: https://cocoacasts.com/should-outlets-be-weak-or-strong/

TLDR: It doesn't really matter — just be consistent.

@IBOutlet var textField: UITextField!

override func viewDidLoad() {
super.viewDidLoad()
label.text = data

}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all these empty lines. It may sound OCD but being neat with your code is very important. You're sharing this codebase with a team, please clean up after yourself.

@IBAction func passItBack(_ sender: Any) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this pattern works, it assumes that the previous view controller is the same as its delegate. A slightly better pattern may be to send the data back to the delegate and then allow the delegate to control any navigation (in this case popping the VC).

However, a much better approach is to use unwind segues here as they handle all of this for you, without the need of a delegate protocol or handling the navigation yourself. This is a great tutorial on this type of segue: https://matteomanferdini.com/unwind-segue/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't know that! Awesome!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure there's somebody out there using these and they have their merits but I've never seen or work in any team that used them. I'd highly recommend you go the Delegate pattern.

Also, each part of the whole system should be named accordingly. This IBAction maybe happens when you tap a button, then make the name say that. What you do inside is another story for me.

delegate?.dataRecieved(data: textField.text!)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should guard that the text field actually contains text, rather than force unwrapping.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, there's very few instances where it does make sense to force unwrap this is not one of them.

self.navigationController?.popViewController(animated: true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self isn't necessary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. You only need to use self when dealing with a closure (for example in a closure after a WebService response comes in.

// dismiss(animated: true, completion: nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code that isn't necessary should be removed to avoid confusion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jimmygtz15 Instead of commenting, can just delete the commented code.


}



}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please delete empty lines too.


Loading