Skip to content

Commit

Permalink
Merge pull request #154 from IBDecodable/feat/verify-ambiguous
Browse files Browse the repository at this point in the history
Verify ambiguous
  • Loading branch information
kateinoigakukun authored Apr 25, 2020
2 parents 39ab498 + 4458527 commit 27c3a9b
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]
jobs:
test:
name: Build and Test
runs-on: macOS-10.14
runs-on: macOS-10.15
steps:
- name: Checkout
uses: actions/checkout@master
Expand Down
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0
5.2
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"repositoryURL": "https://github.com/IBDecodable/IBDecodable.git",
"state": {
"branch": null,
"revision": "b8cf52138805d971c3b2a2a54d8555d3bbaa5b6f",
"version": "0.2.0"
"revision": "213da3d6cf87d1f21813e9ae778377b4586503eb",
"version": "0.3.0"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/IBDecodable/IBDecodable.git", from: "0.2.0"),
.package(url: "https://github.com/IBDecodable/IBDecodable.git", from: "0.3.0"),
.package(url: "https://github.com/Carthage/Commandant.git", .upToNextMinor(from: "0.16.0")),
.package(url: "https://github.com/jpsim/SourceKitten.git", from: "0.22.0"),
.package(url: "https://github.com/xcodeswift/xcproj.git", from: "6.6.0"),
Expand Down
2 changes: 1 addition & 1 deletion Sources/IBLinterKit/Rules/AmbiguousViewRule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extension Rules {

private func validate<T: InterfaceBuilderFile>(for view: ViewProtocol, file: T) -> [Violation] {
let violation: [Violation] = {
if view.isAmbiguous ?? false {
if let isAmbiguous = view.isAmbiguous, isAmbiguous, view.verifyAmbiguity == nil {
let message = "\(viewName(of: view)) has ambiguous constraints"
return [Violation(pathString: file.pathString, message: message, level: .error)]
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/>
<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="lF6-io-qve">
<objects>
<viewController id="7eN-ZX-YSU" sceneMemberID="viewController">
<viewController autoresizesArchivedViewToFullSize="NO" id="7eN-ZX-YSU" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="iGg-Eg-h0O">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand All @@ -27,7 +25,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Second Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oHh-Kj-mCv">
<rect key="frame" x="67.5" y="121" width="104.5" height="21"/>
<rect key="frame" x="68" y="121" width="104.5" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand Down Expand Up @@ -57,5 +55,51 @@
</objects>
<point key="canvasLocation" x="70" y="154"/>
</scene>
<!--View Controller-->
<scene sceneID="IOd-3n-ugA">
<objects>
<viewController id="vrQ-0m-YQo" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ggg-NL-c5H">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view verifyAmbiguity="ignoreSizes" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dsH-Qq-Ghw">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<subviews>
<scrollView verifyAmbiguity="off" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GTc-4J-PFK">
<rect key="frame" x="0.0" y="0.0" width="375" height="563"/>
<color key="backgroundColor" systemColor="systemGreenColor" red="0.20392156859999999" green="0.78039215689999997" blue="0.34901960780000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="contentLayoutGuide" id="odQ-6l-pj3"/>
<viewLayoutGuide key="frameLayoutGuide" id="yqI-du-RsJ"/>
</scrollView>
</subviews>
<color key="backgroundColor" systemColor="systemYellowColor" red="1" green="0.80000000000000004" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="GTc-4J-PFK" secondAttribute="trailing" id="BuE-va-rgi"/>
<constraint firstItem="GTc-4J-PFK" firstAttribute="top" secondItem="dsH-Qq-Ghw" secondAttribute="top" id="J65-Jw-qfI"/>
<constraint firstItem="GTc-4J-PFK" firstAttribute="leading" secondItem="dsH-Qq-Ghw" secondAttribute="leading" id="KwS-s6-7Dr"/>
<constraint firstAttribute="bottom" secondItem="GTc-4J-PFK" secondAttribute="bottom" id="NE2-oB-oBc"/>
</constraints>
</view>
<view verifyAmbiguity="ignoreSizes" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SAf-cy-XCQ">
<rect key="frame" x="67" y="467" width="308" height="200"/>
<color key="backgroundColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="eNh-tr-mRZ" firstAttribute="trailing" secondItem="SAf-cy-XCQ" secondAttribute="trailing" id="6ZT-fd-Dfb"/>
<constraint firstItem="dsH-Qq-Ghw" firstAttribute="top" secondItem="eNh-tr-mRZ" secondAttribute="top" id="MZd-h4-znf"/>
<constraint firstItem="dsH-Qq-Ghw" firstAttribute="leading" secondItem="eNh-tr-mRZ" secondAttribute="leading" id="bv1-q4-8S7"/>
<constraint firstItem="eNh-tr-mRZ" firstAttribute="trailing" secondItem="dsH-Qq-Ghw" secondAttribute="trailing" id="n1L-Ta-wp6"/>
<constraint firstItem="eNh-tr-mRZ" firstAttribute="bottom" secondItem="SAf-cy-XCQ" secondAttribute="bottom" id="t6I-sX-OrI"/>
</constraints>
<viewLayoutGuide key="safeArea" id="eNh-tr-mRZ"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="PmO-7W-hW7" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="68" y="812.74362818590714"/>
</scene>
</scenes>
</document>

0 comments on commit 27c3a9b

Please sign in to comment.