Skip to content

Commit

Permalink
Merge pull request #555 from mbernson/feature/empty-segue-names
Browse files Browse the repository at this point in the history
SegueGenerator: Skip segues that have an empty identifier
  • Loading branch information
tomlokhorst committed Sep 16, 2019
2 parents ee0eadd + 30c092f commit 4420b89
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ResourceApp/ResourceApp.xcodeproj/project.pbxproj
Expand Up @@ -81,6 +81,7 @@
D5F05D481BB520B1003AE55E /* FilesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F05D471BB520B1003AE55E /* FilesTests.swift */; };
D5FAD9091B63B05700ECE230 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D55C6CC61B5D757300301B0D /* Images.xcassets */; };
D80B9E2AC049322EF7FFB2BA /* Pods_Shared_ResourceApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BA2177EF715BB7F766BD6216 /* Pods_Shared_ResourceApp.framework */; };
DD0CD0C4232A950A00A555A3 /* SegueIdentifiers.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DD0CD0C3232A950A00A555A3 /* SegueIdentifiers.storyboard */; };
DEF5599A1CA4873D009B8C51 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF559991CA4873D009B8C51 /* AppDelegate.swift */; };
DEF5599F1CA4873D009B8C51 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DEF5599D1CA4873D009B8C51 /* Main.storyboard */; };
DEF559A11CA4873D009B8C51 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DEF559A01CA4873D009B8C51 /* Assets.xcassets */; };
Expand Down Expand Up @@ -252,6 +253,7 @@
D5F05D431BB52063003AE55E /* Duplicate.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Duplicate.json; sourceTree = "<group>"; };
D5F05D451BB52078003AE55E /* duplicateJson */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = duplicateJson; sourceTree = "<group>"; };
D5F05D471BB520B1003AE55E /* FilesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FilesTests.swift; sourceTree = "<group>"; };
DD0CD0C3232A950A00A555A3 /* SegueIdentifiers.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = SegueIdentifiers.storyboard; sourceTree = "<group>"; };
DEF559971CA4873D009B8C51 /* ResourceApp-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ResourceApp-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
DEF559991CA4873D009B8C51 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
DEF5599E1CA4873D009B8C51 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
Expand Down Expand Up @@ -475,6 +477,7 @@
E25984A022AEE89B00467E1E /* CustomSegue.swift */,
D55C6CBF1B5D757300301B0D /* FirstViewController.swift */,
D5CBCE481B7682B800C5D96B /* MyViewController.swift */,
DD0CD0C3232A950A00A555A3 /* SegueIdentifiers.storyboard */,
D55C6CC11B5D757300301B0D /* SecondViewController.swift */,
D55C6CC61B5D757300301B0D /* Images.xcassets */,
CCBC9CB81EC4809D002F3D0E /* Images2.xcassets */,
Expand Down Expand Up @@ -830,6 +833,7 @@
D50175BE1B5FEFD000DB8314 /* Secondary.storyboard in Resources */,
D5AD5C911B78FC0500A8B96C /* duplicate.xib in Resources */,
D575E25D1B766CD800C22F0B /* My View.xib in Resources */,
DD0CD0C4232A950A00A555A3 /* SegueIdentifiers.storyboard in Resources */,
D5AD5C941B78FC4E00A8B96C /* Duplicate.xib in Resources */,
E2CD68671D7CADEA00BEBE59 /* hello.txt in Resources */,
D55C6CC51B5D757300301B0D /* Main.storyboard in Resources */,
Expand Down
75 changes: 75 additions & 0 deletions ResourceApp/ResourceApp/SegueIdentifiers.storyboard
@@ -0,0 +1,75 @@
<?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="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="Elh-lG-SSX">
<objects>
<viewController storyboardIdentifier="fooController" id="HrG-n6-FlD" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="vwT-hP-vDh">
<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="ng3-RU-Omo">
<rect key="frame" x="179.5" y="433" width="55" height="30"/>
<state key="normal" title="Tap me!"/>
<connections>
<segue destination="ZNm-In-nYu" kind="show" identifier="" id="caA-qX-mBE"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="ng3-RU-Omo" firstAttribute="centerX" secondItem="vwT-hP-vDh" secondAttribute="centerX" id="3d8-jg-zUX"/>
<constraint firstItem="ng3-RU-Omo" firstAttribute="centerY" secondItem="vwT-hP-vDh" secondAttribute="centerY" id="Oul-Jw-qVS"/>
</constraints>
<viewLayoutGuide key="safeArea" id="X6S-rH-NiE"/>
</view>
<connections>
<segue destination="3xr-4N-OFV" kind="show" identifier="goToBaz" id="2ar-g5-qcn"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ZFb-TE-cAg" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-467" y="84"/>
</scene>
<!--View Controller-->
<scene sceneID="ojs-Ki-Ii5">
<objects>
<viewController storyboardIdentifier="barController" id="ZNm-In-nYu" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="NNW-lF-hGd">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="wPw-97-s3b"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="xXW-ou-FAU" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="380" y="-427"/>
</scene>
<!--View Controller-->
<scene sceneID="inW-58-91J">
<objects>
<viewController storyboardIdentifier="bazController" id="3xr-4N-OFV" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="NY0-ZZ-TOt">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="fOE-qb-xRY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="WjL-NR-bo9" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="381" y="269"/>
</scene>
</scenes>
</document>
2 changes: 2 additions & 0 deletions ResourceApp/ResourceAppTests/ResourceAppTests.swift
Expand Up @@ -43,6 +43,8 @@ class ResourceAppTests: XCTestCase {
warning: [R.swift] Skipping string for key FormatSpecifiers5 (Settings), format specifiers don't match for all locales: Base, nl
warning: [R.swift] Skipping string for key mismatch (Settings), format specifiers don't match for all locales: Base, nl
warning: [R.swift] Skipping 1 string in 'Generic' because no swift identifier can be generated for key: '#'
warning: [R.swift] Strings file 'Settings' (nl) has extra translations (not in Base) for keys: 'Only Dutch'
warning: [R.swift] Strings file 'Generic' has extra translations (not in English) for keys: '#'
"""
.trimmingCharacters(in: .whitespacesAndNewlines)
.components(separatedBy: "\n")
Expand Down
4 changes: 4 additions & 0 deletions Sources/RswiftCore/Generators/SegueGenerator.swift
Expand Up @@ -44,6 +44,10 @@ struct SegueStructGenerator: ExternalOnlyStructGenerator {
return nil
}

guard !segue.identifier.isEmpty else {
return nil
}

return SegueWithInfo(segue: segue, sourceType: viewController.type, destinationType: destinationType)
}
}
Expand Down

0 comments on commit 4420b89

Please sign in to comment.