From ab88a73bc759a2a5d6842d202d23a28972da9da0 Mon Sep 17 00:00:00 2001 From: Liu Lantao Date: Sun, 9 Oct 2016 10:22:53 +0800 Subject: [PATCH] UIKit Catalog: Version 13.2, 2016-09-13 Updated to Swift 2.3. --- UICatalog/LICENSE.txt | 2 +- .../UIKitCatalog.xcodeproj/project.pbxproj | 36 +- .../AAPLAlertControllerViewController.m | 2 + .../UIKitCatalog/AAPLAppDelegate.m | 3 + .../UIKitCatalog/AAPLProgressViewController.m | 4 + .../AAPLSearchControllerBaseViewController.m | 2 + .../AAPLSegmentedControlViewController.m | 2 - .../UIKitCatalog/AAPLStackViewController.m | 4 +- .../AAPLTextFieldViewController.m | 56 -- .../UIKitCatalog/AAPLTextViewController.m | 11 +- .../UIKitCatalog/Base.lproj/Main.storyboard | 660 +++++++--------- .../UIKitCatalog/Base.lproj/Search.storyboard | 169 ++--- .../UIKitCatalog/UIKitCatalog-Info.plist | 4 +- .../UIKitCatalog/UIKitCatalog-Prefix.pch | 4 - UICatalog/README.md | 4 +- .../UIKitCatalog.xcodeproj/project.pbxproj | 20 +- .../ActivityIndicatorViewController.swift | 6 +- .../AlertControllerViewController.swift | 10 +- .../Swift/UIKitCatalog/AppDelegate.swift | 6 +- .../UIKitCatalog/Base.lproj/Main.storyboard | 711 ++++++++---------- .../UIKitCatalog/Base.lproj/Search.storyboard | 127 ++-- .../UIKitCatalog/ButtonViewController.swift | 8 +- .../CustomSearchBarViewController.swift | 8 +- .../CustomToolbarViewController.swift | 10 +- .../UIKitCatalog/DatePickerController.swift | 10 +- .../DefaultSearchBarViewController.swift | 8 +- .../DefaultToolbarViewController.swift | 10 +- .../UIKitCatalog/ImageViewController.swift | 4 +- .../PageControlViewController.swift | 8 +- .../UIKitCatalog/PickerViewController.swift | 16 +- .../UIKitCatalog/ProgressViewController.swift | 12 +- ...mbeddedInNavigationBarViewController.swift | 4 +- .../SearchControllerBaseViewController.swift | 6 +- ...esentOverNavigationBarViewController.swift | 4 +- .../SearchResultsViewController.swift | 4 +- ...rchShowResultsInSourceViewController.swift | 4 +- .../SegmentedControlViewController.swift | 9 +- .../UIKitCatalog/SliderViewController.swift | 8 +- .../UIKitCatalog/StackViewController.swift | 10 +- .../UIKitCatalog/StepperViewController.swift | 8 +- .../UIKitCatalog/SwitchViewController.swift | 8 +- .../TextFieldViewController.swift | 64 +- .../UIKitCatalog/TextViewController.swift | 24 +- .../TintedToolbarViewController.swift | 10 +- .../UIKitCatalog/UIKitCatalog-Info.plist | 1 + .../UIKitCatalog/WebViewController.swift | 16 +- 46 files changed, 908 insertions(+), 1209 deletions(-) diff --git a/UICatalog/LICENSE.txt b/UICatalog/LICENSE.txt index 497ad10d..0b752a20 100644 --- a/UICatalog/LICENSE.txt +++ b/UICatalog/LICENSE.txt @@ -1,5 +1,5 @@ Sample code project: UIKit Catalog (iOS): Creating and Customizing UIKit Controls -Version: 13.1 +Version: 13.2 IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following diff --git a/UICatalog/Objective-C/UIKitCatalog.xcodeproj/project.pbxproj b/UICatalog/Objective-C/UIKitCatalog.xcodeproj/project.pbxproj index 35f167b7..cb4cb298 100644 --- a/UICatalog/Objective-C/UIKitCatalog.xcodeproj/project.pbxproj +++ b/UICatalog/Objective-C/UIKitCatalog.xcodeproj/project.pbxproj @@ -14,9 +14,6 @@ 3E8CF107196DD83A00420B6B /* AAPLSearchBarEmbeddedInNavigationBarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E8CF106196DD83A00420B6B /* AAPLSearchBarEmbeddedInNavigationBarViewController.m */; }; 3EC13ADE1933D95700915353 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3EC13AE01933D95700915353 /* Main.storyboard */; }; 3EE0A033196DDDF70059F740 /* AAPLSearchPresentOverNavigationBarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3EE0A032196DDDF70059F740 /* AAPLSearchPresentOverNavigationBarViewController.m */; }; - 5356823E18F3656900BAAD62 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5356823D18F3656900BAAD62 /* Foundation.framework */; }; - 5356824018F3656900BAAD62 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5356823F18F3656900BAAD62 /* CoreGraphics.framework */; }; - 5356824218F3656900BAAD62 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5356824118F3656900BAAD62 /* UIKit.framework */; }; 5356824A18F3656900BAAD62 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5356824918F3656900BAAD62 /* main.m */; }; 5356825918F3656900BAAD62 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5356825818F3656900BAAD62 /* Images.xcassets */; }; 535682A818F3670300BAAD62 /* AAPLActivityIndicatorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5356827818F3670300BAAD62 /* AAPLActivityIndicatorViewController.m */; }; @@ -62,9 +59,6 @@ 3EE0A031196DDDF70059F740 /* AAPLSearchPresentOverNavigationBarViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AAPLSearchPresentOverNavigationBarViewController.h; sourceTree = ""; }; 3EE0A032196DDDF70059F740 /* AAPLSearchPresentOverNavigationBarViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AAPLSearchPresentOverNavigationBarViewController.m; sourceTree = ""; }; 5356823A18F3656900BAAD62 /* UIKitCatalog.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UIKitCatalog.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 5356823D18F3656900BAAD62 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 5356823F18F3656900BAAD62 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 5356824118F3656900BAAD62 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 5356824518F3656900BAAD62 /* UIKitCatalog-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "UIKitCatalog-Info.plist"; sourceTree = ""; }; 5356824918F3656900BAAD62 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 5356824B18F3656900BAAD62 /* UIKitCatalog-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIKitCatalog-Prefix.pch"; sourceTree = ""; }; @@ -123,9 +117,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 5356824018F3656900BAAD62 /* CoreGraphics.framework in Frameworks */, - 5356824218F3656900BAAD62 /* UIKit.framework in Frameworks */, - 5356823E18F3656900BAAD62 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -136,7 +127,7 @@ isa = PBXGroup; children = ( 3E38C1C0196F282000C8EA2C /* Search Bar */, - 3E38C1C1196F282B00C8EA2C /* Search Controlleers */, + 3E38C1C1196F282B00C8EA2C /* Search Controllers */, ); name = Search; sourceTree = ""; @@ -163,7 +154,7 @@ name = "Search Bar"; sourceTree = ""; }; - 3E38C1C1196F282B00C8EA2C /* Search Controlleers */ = { + 3E38C1C1196F282B00C8EA2C /* Search Controllers */ = { isa = PBXGroup; children = ( 3E1D56EF194F68D800D8298E /* Base View Controllers */, @@ -174,7 +165,7 @@ 3E8CF102196DBE6800420B6B /* AAPLSearchShowResultsInSourceViewController.h */, 3E8CF103196DBE6800420B6B /* AAPLSearchShowResultsInSourceViewController.m */, ); - name = "Search Controlleers"; + name = "Search Controllers"; sourceTree = ""; }; 3EF3286C1931DF2000B1C20C /* Toolbar View Controllers */ = { @@ -195,7 +186,6 @@ children = ( 3E5C084C19748F0D00969DD7 /* README.md */, 5356824318F3656900BAAD62 /* UIKitCatalog */, - 5356823C18F3656900BAAD62 /* Frameworks */, 5356823B18F3656900BAAD62 /* Products */, ); sourceTree = ""; @@ -208,16 +198,6 @@ name = Products; sourceTree = ""; }; - 5356823C18F3656900BAAD62 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 5356823D18F3656900BAAD62 /* Foundation.framework */, - 5356823F18F3656900BAAD62 /* CoreGraphics.framework */, - 5356824118F3656900BAAD62 /* UIKit.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; 5356824318F3656900BAAD62 /* UIKitCatalog */ = { isa = PBXGroup; children = ( @@ -322,7 +302,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = f; }; buildConfigurationList = 5356823518F3656900BAAD62 /* Build configuration list for PBXProject "UIKitCatalog" */; @@ -440,12 +420,15 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -480,11 +463,14 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -505,6 +491,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "UIKitCatalog/UIKitCatalog-Prefix.pch"; INFOPLIST_FILE = "$(SRCROOT)/UIKitCatalog/UIKitCatalog-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; PRODUCT_BUNDLE_IDENTIFIER = "com.example.apple-samplecode.UIKitCatalog"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; @@ -518,6 +505,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "UIKitCatalog/UIKitCatalog-Prefix.pch"; INFOPLIST_FILE = "$(SRCROOT)/UIKitCatalog/UIKitCatalog-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; PRODUCT_BUNDLE_IDENTIFIER = "com.example.apple-samplecode.UIKitCatalog"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; diff --git a/UICatalog/Objective-C/UIKitCatalog/AAPLAlertControllerViewController.m b/UICatalog/Objective-C/UIKitCatalog/AAPLAlertControllerViewController.m index 9f60145a..fe4b0f00 100644 --- a/UICatalog/Objective-C/UIKitCatalog/AAPLAlertControllerViewController.m +++ b/UICatalog/Objective-C/UIKitCatalog/AAPLAlertControllerViewController.m @@ -264,6 +264,7 @@ typedef NS_ENUM(NSInteger, AAPLAlertControllerActionSheetRow) { [self presentViewController:alertController animated:YES completion:nil]; } + #pragma mark - UITextFieldTextDidChangeNotification - (void)handleTextFieldTextDidChangeNotification:(NSNotification *)notification { @@ -273,6 +274,7 @@ typedef NS_ENUM(NSInteger, AAPLAlertControllerActionSheetRow) { self.secureTextAlertAction.enabled = textField.text.length >= 5; } + #pragma mark - UITableViewDelegate // Determine the action to perform based on the selected cell. diff --git a/UICatalog/Objective-C/UIKitCatalog/AAPLAppDelegate.m b/UICatalog/Objective-C/UIKitCatalog/AAPLAppDelegate.m index 1f1522a3..c453fa8d 100644 --- a/UICatalog/Objective-C/UIKitCatalog/AAPLAppDelegate.m +++ b/UICatalog/Objective-C/UIKitCatalog/AAPLAppDelegate.m @@ -11,6 +11,8 @@ @interface AAPLAppDelegate() @end +#pragma mark - + @implementation AAPLAppDelegate #pragma mark - UIApplicationDelegate @@ -24,6 +26,7 @@ return YES; } + #pragma mark - UISplitViewControllerDelegate - (UISplitViewControllerDisplayMode)targetDisplayModeForActionInSplitViewController:(UISplitViewController *)splitViewController { diff --git a/UICatalog/Objective-C/UIKitCatalog/AAPLProgressViewController.m b/UICatalog/Objective-C/UIKitCatalog/AAPLProgressViewController.m index 94134ba0..61777597 100644 --- a/UICatalog/Objective-C/UIKitCatalog/AAPLProgressViewController.m +++ b/UICatalog/Objective-C/UIKitCatalog/AAPLProgressViewController.m @@ -57,6 +57,7 @@ static void *AAPLProgressViewControllerContext = &AAPLProgressViewControllerCont [self.progress removeObserver:self forKeyPath:@"fractionCompleted"]; } + #pragma mark - Configuration - (void)configureDefaultStyleProgressView { @@ -74,6 +75,7 @@ static void *AAPLProgressViewControllerContext = &AAPLProgressViewControllerCont self.tintedProgressView.progressTintColor = [UIColor aapl_applicationPurpleColor]; } + #pragma mark - UIViewController - (void)viewDidLoad { @@ -107,6 +109,7 @@ static void *AAPLProgressViewControllerContext = &AAPLProgressViewControllerCont [self.updateTimer invalidate]; } + #pragma mark - Key Value Observing (KVO) - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { @@ -121,6 +124,7 @@ static void *AAPLProgressViewControllerContext = &AAPLProgressViewControllerCont } } + #pragma mark - Convenience - (void)timerDidFire { diff --git a/UICatalog/Objective-C/UIKitCatalog/AAPLSearchControllerBaseViewController.m b/UICatalog/Objective-C/UIKitCatalog/AAPLSearchControllerBaseViewController.m index af850421..c4bc59a4 100644 --- a/UICatalog/Objective-C/UIKitCatalog/AAPLSearchControllerBaseViewController.m +++ b/UICatalog/Objective-C/UIKitCatalog/AAPLSearchControllerBaseViewController.m @@ -29,6 +29,7 @@ NSString *const AAPLSearchControllerBaseViewControllerTableViewCellIdentifier = self.visibleResults = self.allResults; } + #pragma mark - Property Overrides - (void)setFilterString:(NSString *)filterString { @@ -45,6 +46,7 @@ NSString *const AAPLSearchControllerBaseViewControllerTableViewCellIdentifier = [self.tableView reloadData]; } + #pragma mark - UITableViewDataSource - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { diff --git a/UICatalog/Objective-C/UIKitCatalog/AAPLSegmentedControlViewController.m b/UICatalog/Objective-C/UIKitCatalog/AAPLSegmentedControlViewController.m index 3d86623a..929b5cfc 100644 --- a/UICatalog/Objective-C/UIKitCatalog/AAPLSegmentedControlViewController.m +++ b/UICatalog/Objective-C/UIKitCatalog/AAPLSegmentedControlViewController.m @@ -35,8 +35,6 @@ #pragma mark - Configuration - (void)configureDefaultSegmentedControl { - self.defaultSegmentedControl.momentary = YES; - [self.defaultSegmentedControl setEnabled:NO forSegmentAtIndex:0]; [self.defaultSegmentedControl addTarget:self action:@selector(selectedSegmentDidChange:) forControlEvents:UIControlEventValueChanged]; diff --git a/UICatalog/Objective-C/UIKitCatalog/AAPLStackViewController.m b/UICatalog/Objective-C/UIKitCatalog/AAPLStackViewController.m index 1fe60d8c..2ddeebb3 100644 --- a/UICatalog/Objective-C/UIKitCatalog/AAPLStackViewController.m +++ b/UICatalog/Objective-C/UIKitCatalog/AAPLStackViewController.m @@ -35,6 +35,7 @@ static NSInteger AAPLStackViewControllerMaxArrangedSubviewsCount = 3; [self updateAddRemoveButtons]; } + #pragma mark - Actions - (IBAction)showFurtherDetailTapped:(UIButton *)sender { @@ -88,6 +89,7 @@ static NSInteger AAPLStackViewControllerMaxArrangedSubviewsCount = 3; [self updateAddRemoveButtons]; } + #pragma mark - Convenience - (void)updateAddRemoveButtons { @@ -105,4 +107,4 @@ static NSInteger AAPLStackViewControllerMaxArrangedSubviewsCount = 3; return [[UIColor alloc] initWithRed:red green:green blue:blue alpha:1.0]; } -@end \ No newline at end of file +@end diff --git a/UICatalog/Objective-C/UIKitCatalog/AAPLTextFieldViewController.m b/UICatalog/Objective-C/UIKitCatalog/AAPLTextFieldViewController.m index d7806edb..73b06610 100644 --- a/UICatalog/Objective-C/UIKitCatalog/AAPLTextFieldViewController.m +++ b/UICatalog/Objective-C/UIKitCatalog/AAPLTextFieldViewController.m @@ -33,21 +33,6 @@ [self configureCustomTextField]; } -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - - // Listen for changes to keyboard visibility so that we can adjust the text view accordingly. - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleKeyboardNotification:) name:UIKeyboardWillShowNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleKeyboardNotification:) name:UIKeyboardWillHideNotification object:nil]; -} - -- (void)viewDidDisappear:(BOOL)animated { - [super viewDidDisappear:animated]; - - [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil]; -} - #pragma mark - Configuration @@ -124,47 +109,6 @@ } -#pragma mark - Keyboard Event Notifications - -- (void)handleKeyboardNotification:(NSNotification *)notification { - NSDictionary *userInfo = notification.userInfo; - - // Get information about the animation. - NSTimeInterval animationDuration = [userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; - UIViewAnimationOptions animationCurve = [userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue]; - - // Convert the keyboard frame from screen to view coordinates. - CGRect keyboardScreenBeginFrame = [userInfo[UIKeyboardFrameBeginUserInfoKey] CGRectValue]; - CGRect keyboardScreenEndFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; - - CGRect keyboardViewBeginFrame = [self.view convertRect:keyboardScreenBeginFrame fromView:self.view.window]; - CGRect keyboardViewEndFrame = [self.view convertRect:keyboardScreenEndFrame fromView:self.view.window]; - - // Determine how far the keyboard has moved up or down. - CGFloat originDelta = keyboardViewEndFrame.origin.y - keyboardViewBeginFrame.origin.y; - - // Calculate new scroll indicator and content insets for the table view. - UIEdgeInsets newIndicatorInsets = self.tableView.scrollIndicatorInsets; - newIndicatorInsets.bottom -= originDelta; - - UIEdgeInsets newContentInsets = self.tableView.contentInset; - newContentInsets.bottom -= originDelta; - - // Update the insets on the table view with the new values. - self.tableView.scrollIndicatorInsets = newIndicatorInsets; - self.tableView.contentInset = newContentInsets; - - // Inform the view that its the layout should be updated. - [self.view setNeedsLayout]; - - // Animate updating the view's layout by calling `layoutIfNeeded` inside a `UIView` animation block. - UIViewAnimationOptions animationOptions = animationCurve | UIViewAnimationOptionBeginFromCurrentState; - [UIView animateWithDuration:animationDuration delay:0 options:animationOptions animations:^{ - [self.view layoutIfNeeded]; - } completion:nil]; -} - - #pragma mark - Actions - (void)customTextFieldPurpleButtonClicked { diff --git a/UICatalog/Objective-C/UIKitCatalog/AAPLTextViewController.m b/UICatalog/Objective-C/UIKitCatalog/AAPLTextViewController.m index d9a76d00..6705d240 100644 --- a/UICatalog/Objective-C/UIKitCatalog/AAPLTextViewController.m +++ b/UICatalog/Objective-C/UIKitCatalog/AAPLTextViewController.m @@ -83,8 +83,10 @@ - (void)configureTextView { UIFontDescriptor *bodyFontDescriptor = [UIFontDescriptor preferredFontDescriptorWithTextStyle:UIFontTextStyleBody]; - self.textView.font = [UIFont fontWithDescriptor:bodyFontDescriptor size:0]; - + + UIFont *bodyFont = [UIFont fontWithDescriptor:bodyFontDescriptor size:0]; + + self.textView.font = bodyFont; self.textView.textColor = [UIColor blackColor]; self.textView.backgroundColor = [UIColor whiteColor]; self.textView.scrollEnabled = YES; @@ -127,6 +129,11 @@ NSAttributedString *textAttachmentString = [NSAttributedString attributedStringWithAttachment:textAttachment]; [attributedText appendAttributedString:textAttachmentString]; + // Append a space with matching font of the rest of the body text. + NSMutableAttributedString *appendedSpace = [[NSMutableAttributedString alloc] initWithString:@" "]; + [appendedSpace addAttribute:NSFontAttributeName value:bodyFont range:NSMakeRange(0,1)]; + [attributedText appendAttributedString:appendedSpace]; + self.textView.attributedText = attributedText; } diff --git a/UICatalog/Objective-C/UIKitCatalog/Base.lproj/Main.storyboard b/UICatalog/Objective-C/UIKitCatalog/Base.lproj/Main.storyboard index 82e5aeda..79b16a51 100644 --- a/UICatalog/Objective-C/UIKitCatalog/Base.lproj/Main.storyboard +++ b/UICatalog/Objective-C/UIKitCatalog/Base.lproj/Main.storyboard @@ -1,8 +1,9 @@ - + - + + @@ -39,31 +40,31 @@ - + - + - + - + @@ -73,24 +74,24 @@ - + - + @@ -100,24 +101,24 @@ - + - + @@ -127,24 +128,24 @@ - + - + @@ -154,24 +155,24 @@ - + - + @@ -181,24 +182,24 @@ - + - + @@ -208,24 +209,24 @@ - + - + @@ -235,24 +236,24 @@ - + - + @@ -262,24 +263,24 @@ - + - + @@ -289,24 +290,24 @@ - + - + @@ -316,24 +317,24 @@ - + - + @@ -343,24 +344,24 @@ - + - + @@ -370,24 +371,24 @@ - + - + @@ -397,24 +398,24 @@ - + - + @@ -424,24 +425,24 @@ - + - + @@ -451,24 +452,24 @@ - + - + @@ -478,17 +479,17 @@ - + - + @@ -498,17 +499,17 @@ - + - + @@ -540,18 +541,17 @@ - + - - + This is a UITextView that uses attributed text. You can programmatically modify the display of the text by making it bold, highlighted, underlined, tinted, and more. These attributes are defined in NSAttributedString.h. You can even embed attachments in an NSAttributedString! - + @@ -570,7 +570,7 @@ - + @@ -600,32 +600,27 @@ - + - - + - - - @@ -643,7 +638,7 @@ - + @@ -660,21 +655,20 @@ - + - + - + - + - @@ -697,14 +691,13 @@ - + - + - @@ -727,14 +720,13 @@ - + - + - @@ -757,14 +749,13 @@ - + - + - @@ -787,14 +778,13 @@ - + - + - @@ -843,22 +833,20 @@ - + - - - + - + @@ -885,23 +873,22 @@ - + - + - + - + @@ -916,16 +903,15 @@ - + - + @@ -940,16 +926,15 @@ - + - + @@ -964,20 +949,19 @@ - + - + @@ -992,16 +976,15 @@ - + - + @@ -1038,92 +1021,92 @@ - + - + - + - + - + - + - + - + - + - + - + - + @@ -1134,34 +1117,34 @@ - + - + - + - + @@ -1187,21 +1170,20 @@ - + - + - + - + - @@ -1223,14 +1205,13 @@ - + - + - @@ -1252,14 +1233,13 @@ - + - + - @@ -1281,14 +1261,13 @@ - + - + - @@ -1520,18 +1499,17 @@ - + - + @@ -1602,22 +1580,20 @@ - + - + - + - + - - - + @@ -1630,15 +1606,13 @@ - + - + - - - + @@ -1669,22 +1643,20 @@ - + - + - + - + - - - + @@ -1699,15 +1671,13 @@ - + - + - - - + @@ -1723,15 +1693,13 @@ - + - + - - - + @@ -1787,31 +1755,31 @@ - + - + - + - + @@ -1821,24 +1789,24 @@ - + - + @@ -1848,24 +1816,24 @@ - + - + @@ -1893,22 +1861,20 @@ - + - + - + - + - - - + @@ -1921,15 +1887,13 @@ - + - + - - - + @@ -1960,22 +1924,20 @@ - + - + - + - + - - - + @@ -1990,15 +1952,13 @@ - + - + - - - + @@ -2013,15 +1973,13 @@ - + - + - - - + @@ -2055,26 +2013,23 @@ - + - + - + - + - - - + @@ -2092,17 +2047,14 @@ - + - + - - - + @@ -2121,17 +2073,14 @@ - + - + - - - + @@ -2176,20 +2125,18 @@ - + - - - + + - - + - + @@ -2293,11 +2240,10 @@ - + - @@ -2308,8 +2254,7 @@ - - + @@ -2318,7 +2263,7 @@ - + @@ -2348,20 +2293,17 @@ - + - - - - - - - - - - - - - @@ -2465,13 +2382,13 @@ - + - + - + @@ -2500,17 +2417,16 @@ - + - - + @@ -2535,17 +2451,16 @@ - + - - + @@ -2570,17 +2485,16 @@ - + - - + diff --git a/UICatalog/Objective-C/UIKitCatalog/Base.lproj/Search.storyboard b/UICatalog/Objective-C/UIKitCatalog/Base.lproj/Search.storyboard index 0c44a7f9..e2cdb6b5 100644 --- a/UICatalog/Objective-C/UIKitCatalog/Base.lproj/Search.storyboard +++ b/UICatalog/Objective-C/UIKitCatalog/Base.lproj/Search.storyboard @@ -1,7 +1,8 @@ - + - + + @@ -11,7 +12,6 @@ - @@ -26,71 +26,62 @@ - + - - + - + - + - - - + - + - - @@ -100,94 +91,82 @@ - + - + - - - + - + - - - + - + - - @@ -216,20 +195,17 @@ - + - - - - + @@ -260,20 +236,17 @@ - + - - - - + @@ -300,30 +273,26 @@ - + - - + - + - + - - @@ -348,30 +317,26 @@ - + - - + - + - + - - @@ -390,30 +355,26 @@ - + - - + - + - + - - @@ -432,30 +393,26 @@ - + - - + - + - + - - diff --git a/UICatalog/Objective-C/UIKitCatalog/UIKitCatalog-Info.plist b/UICatalog/Objective-C/UIKitCatalog/UIKitCatalog-Info.plist index 9a75cc3d..e45aec11 100644 --- a/UICatalog/Objective-C/UIKitCatalog/UIKitCatalog-Info.plist +++ b/UICatalog/Objective-C/UIKitCatalog/UIKitCatalog-Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 12.0 + 13.2 CFBundleSignature ???? CFBundleVersion - 12.0 + 13.2 LSRequiresIPhoneOS UILaunchStoryboardName diff --git a/UICatalog/Objective-C/UIKitCatalog/UIKitCatalog-Prefix.pch b/UICatalog/Objective-C/UIKitCatalog/UIKitCatalog-Prefix.pch index 0855943f..da31e52c 100644 --- a/UICatalog/Objective-C/UIKitCatalog/UIKitCatalog-Prefix.pch +++ b/UICatalog/Objective-C/UIKitCatalog/UIKitCatalog-Prefix.pch @@ -1,9 +1,5 @@ #import -#ifndef __IPHONE_7_0 -#warning "This project uses features only available in iOS SDK 8.0 and later." -#endif - #ifdef __OBJC__ @import UIKit; @import Foundation; diff --git a/UICatalog/README.md b/UICatalog/README.md index 57d5ae2f..70354ac6 100644 --- a/UICatalog/README.md +++ b/UICatalog/README.md @@ -8,7 +8,7 @@ You will also notice this sample shows how to localize string content by using t ## Build Requirements -Xcode 7.3 and iOS 9.0 SDK or later +Xcode 8.0 and iOS 10.0 SDK or later ## Runtime Requirements @@ -52,4 +52,4 @@ This sample demonstrates how to configure and customize the following controls / + UIToolbar + UIWebView -Copyright (C) 2016 Apple Inc. All rights reserved. +Copyright (C) 2008-2016 Apple Inc. All rights reserved. diff --git a/UICatalog/Swift/UIKitCatalog.xcodeproj/project.pbxproj b/UICatalog/Swift/UIKitCatalog.xcodeproj/project.pbxproj index d9a77c5a..9ddf08d2 100644 --- a/UICatalog/Swift/UIKitCatalog.xcodeproj/project.pbxproj +++ b/UICatalog/Swift/UIKitCatalog.xcodeproj/project.pbxproj @@ -244,8 +244,13 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = Apple; + TargetAttributes = { + 228DB9F218BC53F1002BA12A = { + LastSwiftMigration = 0800; + }; + }; }; buildConfigurationList = 228DB9EE18BC53F1002BA12A /* Build configuration list for PBXProject "UIKitCatalog" */; compatibilityVersion = "Xcode 3.2"; @@ -362,12 +367,15 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -402,11 +410,14 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -424,10 +435,13 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/UIKitCatalog/UIKitCatalog-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.example.apple-samplecode.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 2.3; }; name = Debug; }; @@ -435,10 +449,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/UIKitCatalog/UIKitCatalog-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.example.apple-samplecode.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 2.3; }; name = Release; }; diff --git a/UICatalog/Swift/UIKitCatalog/ActivityIndicatorViewController.swift b/UICatalog/Swift/UIKitCatalog/ActivityIndicatorViewController.swift index 6ece978a..0a11c2aa 100644 --- a/UICatalog/Swift/UIKitCatalog/ActivityIndicatorViewController.swift +++ b/UICatalog/Swift/UIKitCatalog/ActivityIndicatorViewController.swift @@ -9,13 +9,13 @@ import UIKit class ActivityIndicatorViewController: UITableViewController { - // MARK: Properties + // MARK: - Properties @IBOutlet weak var grayStyleActivityIndicatorView: UIActivityIndicatorView! @IBOutlet weak var tintedActivityIndicatorView: UIActivityIndicatorView! - // MARK: View Life Cycle + // MARK: - View Life Cycle override func viewDidLoad() { super.viewDidLoad() @@ -26,7 +26,7 @@ class ActivityIndicatorViewController: UITableViewController { // When activity is done, use UIActivityIndicatorView.stopAnimating(). } - // MARK: Configuration + // MARK: - Configuration func configureGrayActivityIndicatorView() { grayStyleActivityIndicatorView.activityIndicatorViewStyle = .Gray diff --git a/UICatalog/Swift/UIKitCatalog/AlertControllerViewController.swift b/UICatalog/Swift/UIKitCatalog/AlertControllerViewController.swift index 7cc26617..5bbeda3a 100644 --- a/UICatalog/Swift/UIKitCatalog/AlertControllerViewController.swift +++ b/UICatalog/Swift/UIKitCatalog/AlertControllerViewController.swift @@ -9,7 +9,7 @@ import UIKit class AlertControllerViewController : UITableViewController { - // MARK: Properties + // MARK: - Properties weak var secureTextAlertAction: UIAlertAction? @@ -35,7 +35,7 @@ class AlertControllerViewController : UITableViewController { ] } - // MARK: UIAlertControllerStyleAlert Style Alerts + // MARK: - UIAlertControllerStyleAlert Style Alerts /// Show an alert with an "Okay" button. func showSimpleAlert(_: NSIndexPath) { @@ -200,7 +200,7 @@ class AlertControllerViewController : UITableViewController { presentViewController(alertController, animated: true, completion: nil) } - // MARK: UIAlertControllerStyleActionSheet Style Alerts + // MARK: - UIAlertControllerStyleActionSheet Style Alerts /// Show a dialog with an "Okay" and "Cancel" button. func showOkayCancelActionSheet(selectedIndexPath: NSIndexPath) { @@ -266,7 +266,7 @@ class AlertControllerViewController : UITableViewController { presentViewController(alertController, animated: true, completion: nil) } - // MARK: UITextFieldTextDidChangeNotification + // MARK: - UITextFieldTextDidChangeNotification func handleTextFieldTextDidChangeNotification(notification: NSNotification) { let textField = notification.object as! UITextField @@ -280,7 +280,7 @@ class AlertControllerViewController : UITableViewController { } } - // MARK: UITableViewDelegate + // MARK: - UITableViewDelegate override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { let action = actionMap[indexPath.section][indexPath.row] diff --git a/UICatalog/Swift/UIKitCatalog/AppDelegate.swift b/UICatalog/Swift/UIKitCatalog/AppDelegate.swift index db678cc2..9466e845 100644 --- a/UICatalog/Swift/UIKitCatalog/AppDelegate.swift +++ b/UICatalog/Swift/UIKitCatalog/AppDelegate.swift @@ -10,11 +10,11 @@ import UIKit @UIApplicationMain class AppDelegate: NSObject, UIApplicationDelegate, UISplitViewControllerDelegate { - // MARK: Properties + // MARK: - Properties var window: UIWindow? - // MARK: UIApplicationDelegate + // MARK: - UIApplicationDelegate func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { let splitViewController = window!.rootViewController as! UISplitViewController @@ -25,7 +25,7 @@ class AppDelegate: NSObject, UIApplicationDelegate, UISplitViewControllerDelegat return true } - // MARK: UISplitViewControllerDelegate + // MARK: - UISplitViewControllerDelegate func targetDisplayModeForActionInSplitViewController(splitViewController: UISplitViewController) -> UISplitViewControllerDisplayMode { return .AllVisible diff --git a/UICatalog/Swift/UIKitCatalog/Base.lproj/Main.storyboard b/UICatalog/Swift/UIKitCatalog/Base.lproj/Main.storyboard index ed807a4f..68e02624 100644 --- a/UICatalog/Swift/UIKitCatalog/Base.lproj/Main.storyboard +++ b/UICatalog/Swift/UIKitCatalog/Base.lproj/Main.storyboard @@ -1,8 +1,9 @@ - + - + + @@ -24,6 +25,7 @@ + @@ -39,31 +41,31 @@ - + - + - + - + @@ -73,24 +75,24 @@ - + - + @@ -100,24 +102,24 @@ - + - + @@ -127,24 +129,24 @@ - + - + @@ -154,24 +156,24 @@ - + - + @@ -181,24 +183,24 @@ - + - + @@ -208,24 +210,24 @@ - + - + @@ -235,24 +237,24 @@ - + - + @@ -262,24 +264,24 @@ - + - + @@ -289,24 +291,24 @@ - + - + @@ -316,24 +318,24 @@ - + - + @@ -343,24 +345,24 @@ - + - + @@ -370,24 +372,24 @@ - + - + @@ -397,24 +399,24 @@ - + - + @@ -424,24 +426,24 @@ - + - + @@ -451,24 +453,24 @@ - + - + @@ -478,17 +480,17 @@ - + - + @@ -498,17 +500,17 @@ - + - + @@ -540,18 +542,17 @@ - + - - + This is a UITextView that uses attributed text. You can programmatically modify the display of the text by making it bold, highlighted, underlined, tinted, and more. These attributes are defined in NSAttributedString.h. You can even embed attachments in an NSAttributedString! - + @@ -570,7 +571,7 @@ - + @@ -592,58 +593,53 @@ - + - + - - + + - - - + + + - - - - + + + - - + - - - - - - - - + + + + + - + - - + + - + - + - + @@ -658,23 +654,22 @@ - + - + - + - + - + - @@ -697,14 +692,13 @@ - + - + - @@ -727,14 +721,13 @@ - + - + - @@ -757,14 +750,13 @@ - + - + - @@ -787,14 +779,13 @@ - + - + - @@ -843,30 +834,28 @@ - + - - - + - + - + - + @@ -885,23 +874,22 @@ - + - + - + - + @@ -916,16 +904,15 @@ - + - + @@ -940,16 +927,15 @@ - + - + @@ -964,20 +950,19 @@ - + - + @@ -992,16 +977,15 @@ - + - + @@ -1038,92 +1022,92 @@ - + - + - + - + - + - + - + - + - + - + - + - + @@ -1134,34 +1118,34 @@ - + - + - + - + @@ -1187,21 +1171,20 @@ - + - + - + - + - @@ -1223,14 +1206,13 @@ - + - + - @@ -1252,14 +1234,13 @@ - + - + - @@ -1281,14 +1262,13 @@ - + - + - @@ -1390,7 +1370,7 @@ - + @@ -1496,18 +1476,17 @@ - + - + @@ -1578,22 +1557,20 @@ - + - + - + - + - - - + @@ -1606,15 +1583,13 @@ - + - + - - - + @@ -1645,22 +1620,20 @@ - + - + - + - + - - - + @@ -1675,15 +1648,13 @@ - + - + - - - + @@ -1699,15 +1670,13 @@ - + - + - - - + @@ -1773,31 +1742,31 @@ - + - + - + - + @@ -1807,24 +1776,24 @@ - + - + @@ -1834,24 +1803,24 @@ - + - + @@ -1879,22 +1848,20 @@ - + - + - + - + - - - + @@ -1907,15 +1874,13 @@ - + - + - - - + @@ -1946,22 +1911,20 @@ - + - + - + - + - - - + @@ -1976,15 +1939,13 @@ - + - + - - - + @@ -1999,15 +1960,13 @@ - + - + - - - + @@ -2041,26 +2000,23 @@ - + - + - + - + - - - + @@ -2068,7 +2024,7 @@ - + @@ -2078,17 +2034,14 @@ - + - + - - - + @@ -2097,7 +2050,7 @@ - + @@ -2107,23 +2060,20 @@ - + - + - - - + - + @@ -2162,20 +2112,18 @@ - + - - - + + - - + - + @@ -2279,11 +2227,10 @@ - + - @@ -2294,8 +2241,7 @@ - - + @@ -2304,7 +2250,7 @@ - + @@ -2350,37 +2296,28 @@ - + - - @@ -2434,16 +2357,13 @@ - -