Skip to content

Commit

Permalink
Merge pull request #19 from detroit-labs/2018-ipad-pros
Browse files Browse the repository at this point in the history
Add 2018 iPad Pros, Updated Watch Numbers
  • Loading branch information
SlaunchaMan authored Nov 9, 2018
2 parents 6b6183c + aea6f97 commit 11ca3e2
Show file tree
Hide file tree
Showing 16 changed files with 274 additions and 145 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# IRLSize Change Log

## [2.0.1](https://github.com/detroit-labs/IRLSize/releases/tag/2.0.1)
**Released:** 2018-11-08

### Updated
- Improved accuracy of Apple Watch measurements
- Improved the display of the example application, including supporting Dynamic Type

### Added
- Support for 2018 iPad Pro models
- Fixed a bug in estimating iPad Pro sizes
- Added debug logging of estimates (define `IRLSIZE_DEBUG` to `1` to use)

## [2.0.0](https://github.com/detroit-labs/IRLSize/releases/tag/2.0.0)
**Released:** 2018-11-06

Expand Down
4 changes: 2 additions & 2 deletions Example/IRLSizeExample/IRLViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ - (void)viewWillTransitionToSize:(CGSize)size
[self.rulerView setNeedsDisplay];
}

- (void)viewDidLayoutSubviews
- (void)viewWillLayoutSubviews
{
[super viewDidLayoutSubviews];
[super viewWillLayoutSubviews];

[self configureLabels];
}
Expand Down
4 changes: 2 additions & 2 deletions Example/IRLSizeExample/Launch Screen.xib
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
</variation>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="IRLSizeExample" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="278.33333333333331" width="374" height="43"/>
<rect key="frame" x="20" y="277.33333333333331" width="374" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="Kid-kn-2rF"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" id="Kid-kn-2rF"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
Expand Down
32 changes: 19 additions & 13 deletions Example/IRLSizeExample/MainStoryboard.storyboard
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="AeK-B6-oLd">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="AeK-B6-oLd">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand All @@ -31,15 +30,21 @@
<visualEffectView opaque="NO" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="A16-Cm-dZF">
<rect key="frame" x="0.0" y="0.0" width="375" height="128"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" ambiguous="YES" id="QEE-Wb-AKZ">
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="QEE-Wb-AKZ">
<rect key="frame" x="0.0" y="0.0" width="375" height="128"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YB9-WO-T3n" customClass="RulerView" customModule="IRLSizeExample" customModuleProvider="target">
<rect key="frame" x="0.0" y="20" width="375" height="128"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="128"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="YB9-WO-T3n" secondAttribute="trailing" id="1VY-CO-f3h"/>
<constraint firstItem="YB9-WO-T3n" firstAttribute="top" secondItem="QEE-Wb-AKZ" secondAttribute="top" id="eeI-Rg-wnK"/>
<constraint firstItem="YB9-WO-T3n" firstAttribute="leading" secondItem="QEE-Wb-AKZ" secondAttribute="leading" id="hM2-fR-y65"/>
<constraint firstAttribute="bottom" secondItem="YB9-WO-T3n" secondAttribute="bottom" id="pYm-Ae-s0g"/>
</constraints>
</view>
<vibrancyEffect>
<blurEffect style="light"/>
Expand All @@ -56,16 +61,14 @@
</constraints>
<blurEffect style="light"/>
</visualEffectView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Width" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Bs4-HA-XU5">
<rect key="frame" x="165" y="638.5" width="45.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Width" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Bs4-HA-XU5">
<rect key="frame" x="16" y="627.5" width="343" height="31.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle1"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Height" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="mz2-Sx-qRr">
<rect key="frame" x="308" y="323.5" width="51" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Height" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="mz2-Sx-qRr">
<rect key="frame" x="20" y="318" width="339" height="31.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle1"/>
<nil key="highlightedColor"/>
</label>
</subviews>
Expand All @@ -74,10 +77,13 @@
<constraint firstItem="mz2-Sx-qRr" firstAttribute="trailing" secondItem="6gr-T9-C85" secondAttribute="trailingMargin" id="0PV-Av-yde"/>
<constraint firstItem="2eH-vR-4gg" firstAttribute="top" secondItem="go1-Yq-6oD" secondAttribute="bottom" id="Dff-cz-mJb"/>
<constraint firstItem="2eH-vR-4gg" firstAttribute="leading" secondItem="6gr-T9-C85" secondAttribute="leading" id="Fms-1Z-LnO"/>
<constraint firstItem="Bs4-HA-XU5" firstAttribute="leading" secondItem="6gr-T9-C85" secondAttribute="leadingMargin" id="GKE-9j-bqs"/>
<constraint firstAttribute="centerY" secondItem="mz2-Sx-qRr" secondAttribute="centerY" priority="750" id="KhI-4c-xrv"/>
<constraint firstAttribute="trailing" secondItem="2eH-vR-4gg" secondAttribute="trailing" id="UDB-I8-aYg"/>
<constraint firstItem="4PU-od-t1s" firstAttribute="top" secondItem="Bs4-HA-XU5" secondAttribute="bottom" constant="8" symbolic="YES" id="WE7-Cx-x1a"/>
<constraint firstItem="mz2-Sx-qRr" firstAttribute="leading" secondItem="6gr-T9-C85" secondAttribute="leading" constant="20" symbolic="YES" id="iDy-ZR-noq"/>
<constraint firstAttribute="centerX" secondItem="Bs4-HA-XU5" secondAttribute="centerX" id="mOa-9n-quh"/>
<constraint firstAttribute="trailingMargin" secondItem="Bs4-HA-XU5" secondAttribute="trailing" id="trO-ja-YK1"/>
<constraint firstItem="mz2-Sx-qRr" firstAttribute="top" relation="greaterThanOrEqual" secondItem="2eH-vR-4gg" secondAttribute="bottom" constant="8" symbolic="YES" id="u3x-14-ALN"/>
</constraints>
</view>
Expand Down
12 changes: 12 additions & 0 deletions Example/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,15 @@ target 'IRLSizeTests' do
pod "IRLSize", :path => ".."
pod "Kiwi", :inhibit_warnings => true
end

post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name.start_with?('IRLSize')
target.build_configurations.each do |config|
if config.name == 'Debug'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'IRLSIZE_DEBUG=1']
end
end
end
end
end
6 changes: 3 additions & 3 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- IRLSize (2.0.0):
- IRLSize (2.0.1):
- SDVersion (~> 4.3.0)
- Kiwi (3.0.0)
- SDVersion (4.3.2)
Expand All @@ -18,10 +18,10 @@ EXTERNAL SOURCES:
:path: ".."

SPEC CHECKSUMS:
IRLSize: df0a2b3e2283a5afd600e0bb1656d7f4720b5850
IRLSize: 4b54e40ff9925aea803a5e6dbe3852a70eed6d2d
Kiwi: fbeafef0f00e4d8f7dcb3420a4930afe70af77f7
SDVersion: 18f32c835c1543611fcfae3c6accd9a04b90597e

PODFILE CHECKSUM: 24be737e1d2c08b86ebee103a00184355b769706
PODFILE CHECKSUM: 15e9d3b6dd3806b3e609584edb3f6c773b83ff53

COCOAPODS: 1.6.0.beta.2
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ GEM
netrc (~> 0.11)
cocoapods-try (1.1.0)
colored2 (3.1.2)
concurrent-ruby (1.1.1)
concurrent-ruby (1.1.3)
escape (0.0.4)
fourflusher (2.0.1)
fuzzy_match (2.0.4)
Expand Down
2 changes: 1 addition & 1 deletion IRLSize.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "IRLSize"
s.version = "2.0.0"
s.version = "2.0.1"
s.summary = "A library for determining the actual physical size of pixels on an iOS or watchOS device."
s.description = <<-DESC
IRLSize is used to determine the physical size of the device
Expand Down
4 changes: 3 additions & 1 deletion IRLSizeTests/IRLSizeTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
#import <Kiwi/Kiwi.h>
#import <SDVersion/SDVersion.h>

#import "iOSDeviceConstants.h"
#import "IRLMeasurementBeWithinMatcher.h"
#import "iOSDeviceConstants.h"

#define IRL_MM(x) [[NSMeasurement alloc] initWithDoubleValue:(x) unit:IRL_SIZE_UNIT]

#define KNOWN_DEVICE_TEST_UNMATCHING(name, modelEnum, sizeEnumPrefix) \
context(@"on an " name, ^{ \
Expand Down
2 changes: 0 additions & 2 deletions Pod/Classes/IRLSize.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ typedef struct {
} IRLRawDimensions;

#define IRL_SIZE_UNIT NSUnitLength.millimeters
#define IRL_MM(x) [[NSMeasurement alloc] initWithDoubleValue:(x) \
unit:IRL_SIZE_UNIT]

#if TARGET_OS_IOS
#import "UIDevice+IRLSize.h"
Expand Down
39 changes: 39 additions & 0 deletions Pod/Classes/Private/IRLSizeMacros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// IRLSizeMacros.h
// IRLSize
//
// Created by Jeff Kelley on 11/8/2018.
// Copyright © 2018 Detroit Labs. All rights reserved.
//

#ifndef IRLSizeMacros_h
#define IRLSizeMacros_h

#if IRLSIZE_DEBUG
#define DEBUG_LOG(x) NSLog(x)
#else
#define DEBUG_LOG(x)
#endif

#define IRL_MM(x) [[NSMeasurement alloc] initWithDoubleValue:(x) unit:IRL_SIZE_UNIT]

#define IRL_ESTIMATED_DIMENSIONS(variable, deviceType, size) \
case k##deviceType##size##HeightPoints: { \
DEBUG_LOG(@"Estimating height of " #deviceType " at " #size "."); \
variable.height = k##deviceType##size##ScreenHeight; \
variable.width = k##deviceType##size##ScreenWidth; \
} \
break;

#define IRL_KNOWN_DEVICE_DIMENSIONS_UNMATCHING(modelEnum, sizeEnumPrefix)\
case modelEnum: { \
DEBUG_LOG(@"Local device matches " #modelEnum "."); \
size.height = k##sizeEnumPrefix##ScreenHeight; \
size.width = k##sizeEnumPrefix##ScreenWidth; \
} \
break;

#define IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(enum) \
IRL_KNOWN_DEVICE_DIMENSIONS_UNMATCHING(enum, enum)

#endif /* IRLSizeMacros_h */
Loading

0 comments on commit 11ca3e2

Please sign in to comment.