Skip to content

Commit 6a77e57

Browse files
committed
Sample app: add camera image picker
to display the green dot
1 parent a1da130 commit 6a77e57

File tree

6 files changed

+82
-38
lines changed

6 files changed

+82
-38
lines changed

Example/FTLinearActivityIndicator.xcodeproj/project.pbxproj

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
isa = PBXProject;
208208
attributes = {
209209
LastSwiftUpdateCheck = 0830;
210-
LastUpgradeCheck = 1000;
210+
LastUpgradeCheck = 1250;
211211
ORGANIZATIONNAME = CocoaPods;
212212
TargetAttributes = {
213213
607FACCF1AFB9204008FA782 = {
@@ -226,6 +226,7 @@
226226
developmentRegion = English;
227227
hasScannedForEncodings = 0;
228228
knownRegions = (
229+
English,
229230
en,
230231
Base,
231232
);
@@ -303,7 +304,7 @@
303304
files = (
304305
);
305306
inputPaths = (
306-
"${SRCROOT}/Pods/Target Support Files/Pods-FTLinearActivityIndicator_Example/Pods-FTLinearActivityIndicator_Example-frameworks.sh",
307+
"${PODS_ROOT}/Target Support Files/Pods-FTLinearActivityIndicator_Example/Pods-FTLinearActivityIndicator_Example-frameworks.sh",
307308
"${BUILT_PRODUCTS_DIR}/FTLinearActivityIndicator/FTLinearActivityIndicator.framework",
308309
);
309310
name = "[CP] Embed Pods Frameworks";
@@ -312,7 +313,7 @@
312313
);
313314
runOnlyForDeploymentPostprocessing = 0;
314315
shellPath = /bin/sh;
315-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FTLinearActivityIndicator_Example/Pods-FTLinearActivityIndicator_Example-frameworks.sh\"\n";
316+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-FTLinearActivityIndicator_Example/Pods-FTLinearActivityIndicator_Example-frameworks.sh\"\n";
316317
showEnvVarsInLog = 0;
317318
};
318319
/* End PBXShellScriptBuildPhase section */
@@ -369,6 +370,7 @@
369370
isa = XCBuildConfiguration;
370371
buildSettings = {
371372
ALWAYS_SEARCH_USER_PATHS = NO;
373+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
372374
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
373375
CLANG_CXX_LIBRARY = "libc++";
374376
CLANG_ENABLE_MODULES = YES;
@@ -387,6 +389,7 @@
387389
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
388390
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
389391
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
392+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
390393
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
391394
CLANG_WARN_STRICT_PROTOTYPES = YES;
392395
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -424,6 +427,7 @@
424427
isa = XCBuildConfiguration;
425428
buildSettings = {
426429
ALWAYS_SEARCH_USER_PATHS = NO;
430+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
427431
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
428432
CLANG_CXX_LIBRARY = "libc++";
429433
CLANG_ENABLE_MODULES = YES;
@@ -442,6 +446,7 @@
442446
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
443447
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
444448
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
449+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
445450
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
446451
CLANG_WARN_STRICT_PROTOTYPES = YES;
447452
CLANG_WARN_SUSPICIOUS_MOVE = YES;

Example/FTLinearActivityIndicator.xcodeproj/xcshareddata/xcschemes/FTLinearActivityIndicator-Example.xcscheme

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1000"
3+
LastUpgradeVersion = "1250"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -41,6 +41,15 @@
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
4343
shouldUseLaunchSchemeArgsEnv = "YES">
44+
<MacroExpansion>
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
48+
BuildableName = "FTLinearActivityIndicator_Example.app"
49+
BlueprintName = "FTLinearActivityIndicator_Example"
50+
ReferencedContainer = "container:FTLinearActivityIndicator.xcodeproj">
51+
</BuildableReference>
52+
</MacroExpansion>
4453
<Testables>
4554
<TestableReference
4655
skipped = "NO">
@@ -53,17 +62,6 @@
5362
</BuildableReference>
5463
</TestableReference>
5564
</Testables>
56-
<MacroExpansion>
57-
<BuildableReference
58-
BuildableIdentifier = "primary"
59-
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
60-
BuildableName = "FTLinearActivityIndicator_Example.app"
61-
BlueprintName = "FTLinearActivityIndicator_Example"
62-
ReferencedContainer = "container:FTLinearActivityIndicator.xcodeproj">
63-
</BuildableReference>
64-
</MacroExpansion>
65-
<AdditionalOptions>
66-
</AdditionalOptions>
6765
</TestAction>
6866
<LaunchAction
6967
buildConfiguration = "Debug"
@@ -85,8 +83,6 @@
8583
ReferencedContainer = "container:FTLinearActivityIndicator.xcodeproj">
8684
</BuildableReference>
8785
</BuildableProductRunnable>
88-
<AdditionalOptions>
89-
</AdditionalOptions>
9086
</LaunchAction>
9187
<ProfileAction
9288
buildConfiguration = "Release"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
33
<device id="retina4_7" orientation="portrait" appearance="dark"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18092"/>
7+
<capability name="System colors in document resources" minToolsVersion="11.0"/>
78
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
89
</dependencies>
910
<scenes>
@@ -20,60 +21,78 @@
2021
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
2122
<subviews>
2223
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="goq-N5-EcT">
23-
<rect key="frame" x="16" y="243.5" width="343" height="180"/>
24+
<rect key="frame" x="16" y="100" width="343" height="214"/>
2425
<subviews>
25-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AL9-kp-yGM">
26+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AL9-kp-yGM">
2627
<rect key="frame" x="60" y="0.0" width="223" height="30"/>
2728
<state key="normal" title="Toggle network activity indicator"/>
2829
<connections>
2930
<action selector="toggle:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="7vV-3j-Hr1"/>
3031
</connections>
3132
</button>
32-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nQn-vt-jbK">
33+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nQn-vt-jbK">
3334
<rect key="frame" x="50" y="50" width="243" height="30"/>
3435
<state key="normal" title="Toggle standalone activity indicator"/>
3536
<connections>
3637
<action selector="toggleStandAlone:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="bjA-Eh-qPn"/>
3738
</connections>
3839
</button>
39-
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FlV-j3-3FU" customClass="FTLinearActivityIndicator" customModule="FTLinearActivityIndicator">
40-
<rect key="frame" x="131.5" y="164" width="80" height="10"/>
41-
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
42-
<constraints>
43-
<constraint firstAttribute="height" constant="10" id="LgS-gM-GtG"/>
44-
<constraint firstAttribute="width" constant="80" id="rxx-t7-Eyy"/>
45-
</constraints>
46-
</view>
47-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hHq-XK-I1T">
48-
<rect key="frame" x="112" y="101" width="119" height="30"/>
40+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hHq-XK-I1T">
41+
<rect key="frame" x="112" y="100" width="119" height="30"/>
4942
<state key="normal" title="Toggle status bar"/>
5043
<connections>
5144
<action selector="toggleStatusBarWith_sender:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="c1a-25-9EA"/>
5245
</connections>
5346
</button>
47+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pU4-bF-VhJ">
48+
<rect key="frame" x="1" y="150" width="341" height="30"/>
49+
<state key="normal" title="Show image picker (for green dot, only on device)"/>
50+
<connections>
51+
<action selector="showCamera" destination="vXZ-lx-hvc" eventType="touchUpInside" id="O9q-82-qK7"/>
52+
</connections>
53+
</button>
54+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FlV-j3-3FU" customClass="FTLinearActivityIndicator" customModule="FTLinearActivityIndicator">
55+
<rect key="frame" x="131.5" y="200" width="80" height="8"/>
56+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
57+
<constraints>
58+
<constraint firstAttribute="height" constant="8" id="yxg-Yi-UYR"/>
59+
</constraints>
60+
</view>
5461
</subviews>
5562
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
5663
<constraints>
5764
<constraint firstItem="AL9-kp-yGM" firstAttribute="top" secondItem="goq-N5-EcT" secondAttribute="top" id="0AK-a5-MXJ"/>
58-
<constraint firstItem="FlV-j3-3FU" firstAttribute="centerX" secondItem="goq-N5-EcT" secondAttribute="centerX" id="0rF-Gj-cmu"/>
65+
<constraint firstItem="FlV-j3-3FU" firstAttribute="centerX" secondItem="pU4-bF-VhJ" secondAttribute="centerX" id="1bR-E7-mgF"/>
5966
<constraint firstItem="nQn-vt-jbK" firstAttribute="centerX" secondItem="goq-N5-EcT" secondAttribute="centerX" id="6Re-Mf-m3J"/>
60-
<constraint firstItem="hHq-XK-I1T" firstAttribute="top" secondItem="nQn-vt-jbK" secondAttribute="bottom" constant="21" id="GRw-0S-WKZ"/>
67+
<constraint firstItem="pU4-bF-VhJ" firstAttribute="centerX" secondItem="goq-N5-EcT" secondAttribute="centerX" id="9Hg-Lv-ZHX"/>
68+
<constraint firstItem="hHq-XK-I1T" firstAttribute="top" secondItem="nQn-vt-jbK" secondAttribute="bottom" constant="20" id="GRw-0S-WKZ"/>
6169
<constraint firstItem="hHq-XK-I1T" firstAttribute="centerX" secondItem="goq-N5-EcT" secondAttribute="centerX" id="Hkr-My-AP1"/>
6270
<constraint firstItem="nQn-vt-jbK" firstAttribute="top" secondItem="AL9-kp-yGM" secondAttribute="bottom" constant="20" id="KXp-6d-9x3"/>
63-
<constraint firstAttribute="bottom" secondItem="FlV-j3-3FU" secondAttribute="bottom" constant="6" id="LZG-XQ-MOu"/>
6471
<constraint firstItem="AL9-kp-yGM" firstAttribute="centerX" secondItem="goq-N5-EcT" secondAttribute="centerX" id="V7O-B6-zgg"/>
65-
<constraint firstAttribute="height" constant="180" id="Yfr-DT-2zj"/>
72+
<constraint firstItem="pU4-bF-VhJ" firstAttribute="top" secondItem="hHq-XK-I1T" secondAttribute="bottom" constant="20" id="XtE-FD-q7J"/>
73+
<constraint firstAttribute="bottom" secondItem="FlV-j3-3FU" secondAttribute="bottom" constant="6" id="jpA-TN-LCJ"/>
74+
<constraint firstItem="FlV-j3-3FU" firstAttribute="top" secondItem="pU4-bF-VhJ" secondAttribute="bottom" constant="20" id="mKH-pH-ott"/>
75+
<constraint firstItem="FlV-j3-3FU" firstAttribute="leading" secondItem="goq-N5-EcT" secondAttribute="leading" constant="131.5" id="nnO-ug-Gjy"/>
6676
</constraints>
6777
</view>
78+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="VXC-iS-Bsq">
79+
<rect key="frame" x="0.0" y="314" width="375" height="353"/>
80+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
81+
</view>
6882
</subviews>
69-
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
83+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
7084
<constraints>
85+
<constraint firstItem="goq-N5-EcT" firstAttribute="top" secondItem="jyV-Pf-zRb" secondAttribute="bottom" constant="100" id="1hX-6h-syq"/>
86+
<constraint firstAttribute="trailing" secondItem="VXC-iS-Bsq" secondAttribute="trailing" id="C1P-Nm-MaN"/>
7187
<constraint firstItem="goq-N5-EcT" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" id="EfR-mE-saI"/>
7288
<constraint firstAttribute="trailingMargin" secondItem="goq-N5-EcT" secondAttribute="trailing" id="MnY-ew-fRw"/>
73-
<constraint firstItem="goq-N5-EcT" firstAttribute="centerY" secondItem="kh9-bI-dsS" secondAttribute="centerY" id="ZdA-f8-U27"/>
89+
<constraint firstItem="2fi-mo-0CV" firstAttribute="top" secondItem="VXC-iS-Bsq" secondAttribute="bottom" id="fT5-Yz-5Jb"/>
90+
<constraint firstItem="VXC-iS-Bsq" firstAttribute="top" secondItem="goq-N5-EcT" secondAttribute="bottom" id="i0j-Et-yjy"/>
91+
<constraint firstItem="VXC-iS-Bsq" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leading" id="kzt-8z-4JR"/>
7492
</constraints>
7593
</view>
7694
<connections>
95+
<outlet property="imagePickerContainer" destination="VXC-iS-Bsq" id="RIm-Tf-y6g"/>
7796
<outlet property="standAloneIndicator" destination="FlV-j3-3FU" id="sHF-TN-0Wg"/>
7897
</connections>
7998
</viewController>
@@ -82,4 +101,9 @@
82101
<point key="canvasLocation" x="32.799999999999997" y="32.833583208395808"/>
83102
</scene>
84103
</scenes>
104+
<resources>
105+
<systemColor name="systemBackgroundColor">
106+
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
107+
</systemColor>
108+
</resources>
85109
</document>

Example/FTLinearActivityIndicator/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,7 @@
3535
<string>UIInterfaceOrientationPortrait</string>
3636
<string>UIInterfaceOrientationLandscapeLeft</string>
3737
</array>
38+
<key>NSCameraUsageDescription</key>
39+
<string>NSCameraUsageDescription</string>
3840
</dict>
3941
</plist>

Example/FTLinearActivityIndicator/ViewController.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import FTLinearActivityIndicator
1111

1212
class ViewController: UIViewController {
1313
@IBOutlet var standAloneIndicator: FTLinearActivityIndicator?
14+
@IBOutlet var imagePickerContainer: UIView!
1415

1516
var statusBarHidden = false
1617

@@ -43,6 +44,14 @@ class ViewController: UIViewController {
4344
setNeedsStatusBarAppearanceUpdate()
4445
}
4546

47+
@IBAction func showCamera() {
48+
let cameraPickerController = UIImagePickerController()
49+
cameraPickerController.sourceType = .camera
50+
51+
imagePickerContainer.addSubview(cameraPickerController.view)
52+
addChild(cameraPickerController)
53+
}
54+
4655
override var prefersStatusBarHidden: Bool {
4756
get {
4857
return statusBarHidden

0 commit comments

Comments
 (0)