Skip to content

Commit

Permalink
add UserDefaults clear button
Browse files Browse the repository at this point in the history
  • Loading branch information
senseiphoneX authored and BalestraPatrick committed Nov 11, 2017
1 parent 87912d1 commit 0a0f0c9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
30 changes: 24 additions & 6 deletions Example/WhatsNew/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModule="WhatsNew_Example" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Mfy-zO-GJW">
<rect key="frame" x="169" y="562" width="36" height="30"/>
<state key="normal" title="Clear"/>
<connections>
<action selector="clear:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="dVB-Vc-RSY"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="2fi-mo-0CV" firstAttribute="top" secondItem="Mfy-zO-GJW" secondAttribute="bottom" constant="75" id="2Fc-gM-1Vv"/>
<constraint firstItem="Mfy-zO-GJW" firstAttribute="centerX" secondItem="kh9-bI-dsS" secondAttribute="centerX" id="gbJ-2W-jfS"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
Expand Down
4 changes: 4 additions & 0 deletions Example/WhatsNew/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ class ViewController: UIViewController {
])
whatsNew.presentIfNeeded(on: self)
}

@IBAction func clear(_ sender: Any) {
UserDefaults.standard.removeObject(forKey: "LatestAppVersionPresented")
}
}

0 comments on commit 0a0f0c9

Please sign in to comment.