diff --git a/Classes/DemoAppDelegate.h b/Classes/DemoAppDelegate.h index 81f0825..ddc6460 100644 --- a/Classes/DemoAppDelegate.h +++ b/Classes/DemoAppDelegate.h @@ -29,13 +29,10 @@ @class DemoViewController; -@interface DemoAppDelegate : NSObject { - UIWindow *window; - DemoViewController *viewController; -} +@interface DemoAppDelegate : UIResponder -@property (nonatomic, retain) IBOutlet UIWindow *window; -@property (nonatomic, retain) IBOutlet DemoViewController *viewController; +@property (nonatomic, strong) UIWindow *window; +@property (nonatomic, strong) DemoViewController *viewController; @end diff --git a/Classes/DemoAppDelegate.m b/Classes/DemoAppDelegate.m index 0481b4e..0b196f0 100644 --- a/Classes/DemoAppDelegate.m +++ b/Classes/DemoAppDelegate.m @@ -30,27 +30,15 @@ @implementation DemoAppDelegate -@synthesize window; -@synthesize viewController; - - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after app launch - - // Add the split view controller's view to the window and display. - [window addSubview:viewController.view]; - [window makeKeyAndVisible]; + _window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds]; + _window.backgroundColor = UIColor.whiteColor; + _window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[[DemoViewController alloc] init]]; + [_window makeKeyAndVisible]; return YES; } - -- (void)dealloc { - [viewController release]; - [window release]; - [super dealloc]; -} - - @end diff --git a/Classes/DemoViewController.m b/Classes/DemoViewController.m index 3b84634..ab1d9e2 100644 --- a/Classes/DemoViewController.m +++ b/Classes/DemoViewController.m @@ -50,9 +50,9 @@ - (NSMutableAttributedString *)textForEditing; &kCFTypeDictionaryValueCallBacks ); - NSMutableAttributedString *string = [[[NSMutableAttributedString alloc] + NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@"Lorem Ipsum\nLorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vitae turpis urna, aliquam rutrum libero. Quisque justo odio, iaculis non luctus sit amet, bibendum a dolor. Fusce dolor mauris, tempus eget eleifend id, facilisis quis urna. Fusce iaculis congue sem, nec ullamcorper mi rutrum vitae. Proin molestie pellentesque imperdiet. Sed dictum nulla vitae arcu vulputate aliquet. Etiam at rutrum neque. Nam volutpat mollis lacinia. Suspendisse quis tellus massa. Nullam in iaculis metus. Nam dolor turpis, congue luctus fringilla et, congue a urna. Aliquam erat volutpat. Quisque ornare, augue sed mattis vulputate, orci diam varius urna, ut scelerisque lacus urna vitae urna. Cras dictum tempor egestas. Duis eu nibh a diam feugiat dapibus. Sed et libero turpis, in fermentum leo. Etiam vel augue odio, vitae porttitor enim." - attributes:(NSDictionary *)attr] autorelease]; + attributes:(__bridge NSDictionary *)attr]; CFRelease(attr); @@ -69,7 +69,7 @@ - (NSMutableAttributedString *)textForEditing; titleColour ); - CFAttributedStringSetAttribute((CFMutableAttributedStringRef)string, CFRangeMake(0, 5), kCTStrokeWidthAttributeName, [NSNumber numberWithFloat:2]); + CFAttributedStringSetAttribute((CFMutableAttributedStringRef)string, CFRangeMake(0, 5), kCTStrokeWidthAttributeName, (__bridge CFTypeRef)([NSNumber numberWithFloat:2])); CFAttributedStringSetAttribute((CFMutableAttributedStringRef)string, CFRangeMake(0, 5), kCTStrokeColorAttributeName, [UIColor blueColor].CGColor); NSLog(@"%@", string); @@ -85,14 +85,12 @@ - (NSDictionary *)defaultStyle; #pragma mark View Management // Implement loadView to create a view hierarchy programmatically, without using a nib. -- (void)loadView { - UIScreen *screen = [UIScreen mainScreen]; - // Load your primary view here for the demo - self.view = [[RTKView alloc] initWithFrame:[screen applicationFrame] delegate:self]; -} +- (void)viewDidLoad { + [super viewDidLoad]; -- (void)dealloc { - [super dealloc]; + RTKView *textView = [[RTKView alloc] initWithFrame:self.view.bounds delegate:self]; + textView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + [self.view addSubview:textView]; } @end diff --git a/DemoViewController.xib b/DemoViewController.xib deleted file mode 100644 index 84178b4..0000000 --- a/DemoViewController.xib +++ /dev/null @@ -1,153 +0,0 @@ - - - - 1024 - 10D573 - 783 - 1038.29 - 460.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 107 - - - YES - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - {320, 460} - - 3 - MC43NQA - - 2 - - - NO - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 7 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 6 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 6.IBEditorWindowLastContentRect - 6.IBPluginDependency - - - YES - DemoViewController - UIResponder - {{239, 654}, {320, 480}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 7 - - - - YES - - DemoViewController - UIViewController - - IBUserSource - - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - RichTextKit.xcodeproj - 3 - 107 - - diff --git a/Launch Screen.storyboard b/Launch Screen.storyboard new file mode 100644 index 0000000..2fdbe5a --- /dev/null +++ b/Launch Screen.storyboard @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MainWindow.xib b/MainWindow.xib deleted file mode 100644 index 6751254..0000000 --- a/MainWindow.xib +++ /dev/null @@ -1,493 +0,0 @@ - - - - 800 - 10D573 - 783 - 1038.29 - 460.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 107 - - - YES - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - IBCocoaTouchFramework - - - DemoViewController - - - 1 - - IBCocoaTouchFramework - NO - - - - 292 - {320, 480} - - - - 1 - MSAxIDEAA - - NO - NO - - IBCocoaTouchFramework - YES - YES - - - - - YES - - - delegate - - - - 4 - - - - window - - - - 14 - - - - viewController - - - - 16 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - 3 - - - RichTextKit Demo App Delegate - - - -2 - - - - - 10 - - - - - 12 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 10.CustomClassName - 10.IBEditorWindowLastContentRect - 10.IBPluginDependency - 12.IBEditorWindowLastContentRect - 12.IBPluginDependency - 3.CustomClassName - 3.IBPluginDependency - - - YES - UIApplication - UIResponder - DemoViewController - {{234, 376}, {320, 480}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{525, 346}, {320, 480}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - DemoAppDelegate - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 16 - - - - YES - - DemoAppDelegate - NSObject - - YES - - YES - viewController - window - - - YES - DemoViewController - UIWindow - - - - YES - - YES - viewController - window - - - YES - - viewController - DemoViewController - - - window - UIWindow - - - - - IBProjectSource - Classes/DemoAppDelegate.h - - - - DemoAppDelegate - NSObject - - IBUserSource - - - - - DemoViewController - UIViewController - - IBProjectSource - Classes/DemoViewController.h - - - - DemoViewController - UIViewController - - IBUserSource - - - - - UIWindow - UIView - - rootViewController - UIViewController - - - rootViewController - - rootViewController - UIViewController - - - - IBUserSource - - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSNetServices.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPort.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSStream.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSXMLParser.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIApplication - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIApplication.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - UIWindow - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIWindow.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - RichTextKit.xcodeproj - 3 - 107 - - diff --git a/RichTextKit-Info.plist b/RichTextKit-Info.plist index 3289444..02ed439 100644 --- a/RichTextKit-Info.plist +++ b/RichTextKit-Info.plist @@ -11,20 +11,24 @@ CFBundleIconFile CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL + CFBundleShortVersionString + 1 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS - NSMainNibFile - MainWindow + UILaunchStoryboardName + Launch Screen + UIUserInterfaceStyle + Light diff --git a/RichTextKit.entitlements b/RichTextKit.entitlements new file mode 100644 index 0000000..ee95ab7 --- /dev/null +++ b/RichTextKit.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.network.client + + + diff --git a/RichTextKit.xcodeproj/project.pbxproj b/RichTextKit.xcodeproj/project.pbxproj index 4e9dcfd..9fa7b63 100755 --- a/RichTextKit.xcodeproj/project.pbxproj +++ b/RichTextKit.xcodeproj/project.pbxproj @@ -7,13 +7,12 @@ objects = { /* Begin PBXBuildFile section */ + 151AFCE0240763A800631664 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 151AFCDF240763A800631664 /* Launch Screen.storyboard */; }; 1D3623260D0F684500981E51 /* DemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* DemoAppDelegate.m */; }; 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; - 2899E5220DE3E06400AC0155 /* DemoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* DemoViewController.xib */; }; - 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; 28D7ACF80DDB3853001CB0EB /* DemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* DemoViewController.m */; }; DD7CFA0911721C4B0028A53F /* RichTextKit_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = 32CA4F630368D1EE00C91783 /* RichTextKit_Prefix.pch */; }; DD7CFA0D11721CC20028A53F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; @@ -57,14 +56,14 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 151AFCDE240762F700631664 /* RichTextKit.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RichTextKit.entitlements; sourceTree = ""; }; + 151AFCDF240763A800631664 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 1D3623240D0F684500981E51 /* DemoAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoAppDelegate.h; sourceTree = ""; }; 1D3623250D0F684500981E51 /* DemoAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoAppDelegate.m; sourceTree = ""; }; 1D6058910D05DD3D006BFB54 /* RichTextKit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RichTextKit.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 2899E5210DE3E06400AC0155 /* DemoViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DemoViewController.xib; sourceTree = ""; }; - 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; 28D7ACF60DDB3853001CB0EB /* DemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoViewController.h; sourceTree = ""; }; 28D7ACF70DDB3853001CB0EB /* DemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoViewController.m; sourceTree = ""; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -148,6 +147,7 @@ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { isa = PBXGroup; children = ( + 151AFCDE240762F700631664 /* RichTextKit.entitlements */, DD7CF92311720D8B0028A53F /* RichTextKit Framework */, 080E96DDFE201D6D7F000001 /* Classes */, 29B97315FDCFA39411CA2CEA /* Other Sources */, @@ -175,10 +175,9 @@ DDF4002711947364001CB9E3 /* RTKSelectionLoupe.png */, DDF4002811947364001CB9E3 /* RTKSelectionLoupeMask.png */, DDF4002911947364001CB9E3 /* RTKSelectionHandle.png */, - 2899E5210DE3E06400AC0155 /* DemoViewController.xib */, - 28AD733E0D9D9553002E5188 /* MainWindow.xib */, 8D1107310486CEB800E47090 /* RichTextKit-Info.plist */, DD7CF970117211070028A53F /* RichTextKit.framework-Info.plist */, + 151AFCDF240763A800631664 /* Launch Screen.storyboard */, ); name = Resources; sourceTree = ""; @@ -301,9 +300,17 @@ /* Begin PBXProject section */ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; + attributes = { + LastUpgradeCheck = 1130; + }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "RichTextKit" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = en; hasScannedForEncodings = 1; + knownRegions = ( + en, + Base, + ); mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; projectDirPath = ""; projectRoot = ""; @@ -319,8 +326,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, - 2899E5220DE3E06400AC0155 /* DemoViewController.xib in Resources */, + 151AFCE0240763A800631664 /* Launch Screen.storyboard in Resources */, DDF4002B11947364001CB9E3 /* RTKCaretLoupe.png in Resources */, DDF4002C11947364001CB9E3 /* RTKCaretLoupeMask.png in Resources */, DDF4002D11947364001CB9E3 /* RTKSelectionLoupe.png in Resources */, @@ -373,7 +379,12 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_ENTITLEMENTS = RichTextKit.entitlements; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; COPY_PHASE_STRIP = NO; + DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -384,8 +395,11 @@ "-ObjC", "-all_load", ); + PRODUCT_BUNDLE_IDENTIFIER = "com.yourcompany.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = RichTextKit; - TARGETED_DEVICE_FAMILY = 2; + SDKROOT = iphoneos; + SUPPORTS_MACCATALYST = YES; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; @@ -393,11 +407,20 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_ENTITLEMENTS = RichTextKit.entitlements; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; COPY_PHASE_STRIP = YES; + DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = RichTextKit_Prefix.pch; INFOPLIST_FILE = "RichTextKit-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "com.yourcompany.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = RichTextKit; + SDKROOT = iphoneos; + SUPPORTS_MACCATALYST = YES; + TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; @@ -405,13 +428,37 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - PREBINDING = NO; - SDKROOT = iphoneos3.2; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -419,14 +466,36 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; - PREBINDING = NO; - SDKROOT = iphoneos3.2; + SDKROOT = iphoneos; }; name = Release; }; @@ -434,12 +503,13 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; - PREBINDING = NO; PRODUCT_NAME = RichTextKit; - SDKROOT = iphoneos3.2; + SDKROOT = iphoneos; }; name = Debug; }; @@ -447,11 +517,12 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - PREBINDING = NO; PRODUCT_NAME = RichTextKitMobile; + SDKROOT = iphoneos; ZERO_LINK = NO; }; name = Release; diff --git a/RichTextKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/RichTextKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/RichTextKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/RichTextKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/RichTextKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/RichTextKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/include/RichTextKit/RTKCaret.m b/include/RichTextKit/RTKCaret.m index 81525ad..001ec40 100644 --- a/include/RichTextKit/RTKCaret.m +++ b/include/RichTextKit/RTKCaret.m @@ -70,10 +70,4 @@ -(void)animationFadeOut { } } - -- (void)dealloc { - [super dealloc]; -} - - @end diff --git a/include/RichTextKit/RTKCaretLoupeView.m b/include/RichTextKit/RTKCaretLoupeView.m index faaa109..91ffaf1 100644 --- a/include/RichTextKit/RTKCaretLoupeView.m +++ b/include/RichTextKit/RTKCaretLoupeView.m @@ -34,8 +34,8 @@ - (id)initWithFrame:(CGRect)frame { UIImage *mask = [UIImage imageNamed:@"RTKCaretLoupeMask.png"]; if (self = [super initWithFrame:CGRectMake(0.0f, 0.0f, mask.size.width, mask.size.height)]) { self.backgroundColor = [UIColor clearColor]; - _mask = [mask retain]; - _loop = [[UIImage imageNamed:@"RTKCaretLoupe.png"] retain]; + _mask = mask; + _loop = [UIImage imageNamed:@"RTKCaretLoupe.png"]; } return self; } diff --git a/include/RichTextKit/RTKDocument.h b/include/RichTextKit/RTKDocument.h index 4fe3e30..c493225 100644 --- a/include/RichTextKit/RTKDocument.h +++ b/include/RichTextKit/RTKDocument.h @@ -65,7 +65,6 @@ UITextRange *selectedTextRange; // UITextRange *markedTextRange; // NSDictionary *markedTextStyle; - id inputDelegate; id tokenizer; UIView *textInputView; UITextStorageDirection selectionAffinity; diff --git a/include/RichTextKit/RTKDocument.m b/include/RichTextKit/RTKDocument.m index b8151fa..9c44ac3 100644 --- a/include/RichTextKit/RTKDocument.m +++ b/include/RichTextKit/RTKDocument.m @@ -93,29 +93,29 @@ - (id)initWithFrame:(CGRect)frame delegate:(id)delegate; if ((self = [super initWithFrame:frame])) { // Initialization code - _delegate = [delegate retain]; + _delegate = delegate; // Set the background to white. self.backgroundColor = [UIColor whiteColor]; - _lineCache = [[NSMutableArray array] retain]; + _lineCache = [NSMutableArray array]; // Add a caret Object - caret = [[[RTKCaret alloc] initWithFrame:CGRectZero] retain]; + caret = [[RTKCaret alloc] initWithFrame:CGRectZero]; // Add selection handles - selectionHandleStart = [[[RTKSelectionHandle alloc] initWithFrame:CGRectZero position:RTKSelectionHandlePostitionStart] retain]; - selectionHandleEnd = [[[RTKSelectionHandle alloc] initWithFrame:CGRectZero position:RTKSelectionHandlePostitionEnd] retain]; + selectionHandleStart = [[RTKSelectionHandle alloc] initWithFrame:CGRectZero position:RTKSelectionHandlePostitionStart]; + selectionHandleEnd = [[RTKSelectionHandle alloc] initWithFrame:CGRectZero position:RTKSelectionHandlePostitionEnd]; - _selectionFirstLine = [[[UIView alloc] initWithFrame:CGRectZero] retain]; + _selectionFirstLine = [[UIView alloc] initWithFrame:CGRectZero]; _selectionFirstLine.backgroundColor = [UIColor redColor]; _selectionFirstLine.alpha = 0.15; - _selectionLastLine = [[[UIView alloc] initWithFrame:CGRectZero] retain]; + _selectionLastLine = [[UIView alloc] initWithFrame:CGRectZero]; _selectionLastLine.backgroundColor = [UIColor yellowColor]; _selectionLastLine.alpha = 0.15; - _selectionRange = [[[UIView alloc] initWithFrame:CGRectZero] retain]; + _selectionRange = [[UIView alloc] initWithFrame:CGRectZero]; _selectionRange.backgroundColor = [UIColor blueColor]; _selectionRange.alpha = 0.15; @@ -145,15 +145,6 @@ - (id)initWithFrame:(CGRect)frame delegate:(id)delegate; #pragma mark - #pragma mark Memory Management -- (void)dealloc; -{ - [_lineCache release]; - [selectionHandleStart release]; - [selectionHandleEnd release]; - [caret release]; - [super dealloc]; -} - #pragma mark - #pragma mark Responder @@ -383,8 +374,8 @@ - (void)_moveEditingAction:(NSSet *)touches; // pos > end so select last character. start = [RTKTextPosition positionWithInteger:[end position] - 1]; } - [_lastPosition release]; - _lastPosition = [start retain]; + + _lastPosition = start; break; case RTKSelectionHandlePostitionEnd: if ([self comparePosition:pos toPosition:start] == NSOrderedAscending) { @@ -394,8 +385,8 @@ - (void)_moveEditingAction:(NSSet *)touches; // pos > start end = pos; } - [_lastPosition release]; - _lastPosition = [end retain]; + + _lastPosition = end; break; } [self setSelectedTextRange:[RTKTextRange rangeWithStart:start end:end]]; @@ -417,8 +408,8 @@ - (void)_moveEditingAction:(NSSet *)touches; // pos > end end = pos; } - [_lastPosition release]; - _lastPosition = [pos retain]; + + _lastPosition = pos; [self setSelectedTextRange:[RTKTextRange rangeWithStart:start end:end]]; [self _moveSelectionLoop:touches]; @@ -476,7 +467,7 @@ - (void)_showCaretLoop:(NSSet *)touches; UIMenuController *menuCont = [UIMenuController sharedMenuController]; [menuCont setMenuVisible:NO animated:YES]; - _caretLoop = [[[RTKCaretLoupeView alloc] init] retain]; + _caretLoop = [[RTKCaretLoupeView alloc] init]; [_caretLoop setMagnifyView:self]; CGPoint touchPointWin = [[touches anyObject] locationInView:[[UIApplication sharedApplication] keyWindow]]; [_caretLoop setCenter:CGPointMake(touchPointWin.x, touchPointWin.y - 65)]; @@ -506,7 +497,6 @@ - (void)_hideCaretLoop:(NSSet *)touches; if(_caretLoop != nil){ [caret setAnimated:YES]; [_caretLoop removeFromSuperview]; - [_caretLoop release]; _caretLoop = nil; } } @@ -514,7 +504,7 @@ - (void)_hideCaretLoop:(NSSet *)touches; - (void)_showSelectionLoop:(NSSet *)touches; { if(_selectionLoop == nil){ - _selectionLoop = [[[RTKSelectionLoupeView alloc] init] retain]; + _selectionLoop = [[RTKSelectionLoupeView alloc] init]; [_selectionLoop setMagnifyView:self]; // TODO Fix it to the handle that is dragged CGPoint touchPointWin = [[touches anyObject] locationInView:[[UIApplication sharedApplication] keyWindow]]; @@ -548,7 +538,6 @@ - (void)_hideSelectionLoop:(NSSet *)touches; { if(_selectionLoop != nil){ [_selectionLoop removeFromSuperview]; - [_selectionLoop release]; _selectionLoop = nil; } } @@ -648,10 +637,9 @@ - (void)_highlightWordAtPosition:(RTKTextPosition *)pos; } if (word) { [self setSelectedTextRange:word]; - - [_selectedWord release]; + _selectedWord = nil; - _selectedWord = [word retain]; + _selectedWord = word; } } @@ -758,7 +746,7 @@ - (void)drawRect:(CGRect)rect; CGPathAddRect(path, NULL, textBounds); // Get the string we'll be drawing. - CFMutableAttributedStringRef attrString = (CFMutableAttributedStringRef)self.textStore; + CFMutableAttributedStringRef attrString = (__bridge CFMutableAttributedStringRef)self.textStore; // Create a framesetter for it. CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(attrString); @@ -1009,7 +997,6 @@ - (void)insertText:(NSString *)theText; // There is no selection so append it to the end. NSAttributedString *as = [[NSAttributedString alloc] initWithString:theText attributes:attr]; [self.textStore appendAttributedString:as]; - [as release]; UITextRange *newRange = [RTKTextRange rangeWithStart:(RTKTextPosition *)[self endOfDocument] @@ -1027,7 +1014,6 @@ - (void)insertText:(NSString *)theText; NSAttributedString *as = [[NSAttributedString alloc] initWithString:theText attributes:attr]; NSUInteger index = [(RTKTextPosition *)self.selectedTextRange.end position]; [self.textStore insertAttributedString:as atIndex:index]; - [as release]; // Place selection after the new text. RTKTextPosition *pos = [RTKTextPosition positionWithInteger: index + [theText length]]; @@ -1133,7 +1119,7 @@ - (void)setSelectedTextRange:(UITextRange *)aSelectedTextRange; [self.inputDelegate selectionWillChange:self]; - selectedTextRange = [[aSelectedTextRange copy] retain]; + selectedTextRange = [aSelectedTextRange copy]; [self.inputDelegate selectionDidChange:self]; @@ -1424,7 +1410,7 @@ - (void)setInputDelegate:(id )inputDelegate; { DebugLog(@"%@",[NSThread callStackSymbols]); if (tokenizer == nil) { - tokenizer = [[[UITextInputStringTokenizer alloc] initWithTextInput:self] retain]; + tokenizer = [[UITextInputStringTokenizer alloc] initWithTextInput:self]; } return tokenizer; } @@ -1479,7 +1465,7 @@ - (CGRect)caretRectForPosition:(UITextPosition *)position; int caretIndex = [(RTKTextPosition *)position position]; NSAttributedString *subString = [textStore attributedSubstringFromRange:NSMakeRange([(RTKTextPosition *)[self beginningOfDocument] position], caretIndex)]; - CFMutableAttributedStringRef attrString = (CFMutableAttributedStringRef)subString; + CFMutableAttributedStringRef attrString = (__bridge CFMutableAttributedStringRef)subString; CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(attrString); @@ -1574,7 +1560,7 @@ - (UITextPosition *)closestPositionToPoint:(CGPoint)point; CGMutablePathRef path = CGPathCreateMutable(); CGPathAddRect(path, NULL, textBounds); - CFMutableAttributedStringRef attrString = (CFMutableAttributedStringRef)self.textStore; + CFMutableAttributedStringRef attrString = (__bridge CFMutableAttributedStringRef)self.textStore; CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(attrString); CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL); diff --git a/include/RichTextKit/RTKLoupeView.m b/include/RichTextKit/RTKLoupeView.m index a2a2a98..b9a74c0 100644 --- a/include/RichTextKit/RTKLoupeView.m +++ b/include/RichTextKit/RTKLoupeView.m @@ -72,16 +72,6 @@ - (void)setTouchPoint:(CGPoint)point { } } - -- (void)dealloc { - [_cache release]; - [_mask release]; - [_loop release]; - [magnifyView release]; - [super dealloc]; -} - - - (void)drawRect:(CGRect)rect { /* @@ -93,7 +83,7 @@ - (void)drawRect:(CGRect)rect { } */ - UIGraphicsBeginImageContext(self.magnifyView.bounds.size); + UIGraphicsBeginImageContextWithOptions(self.magnifyView.bounds.size, NO, 0); [self.magnifyView.layer renderInContext:UIGraphicsGetCurrentContext()]; _cache = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); @@ -111,13 +101,19 @@ - (void)drawRect:(CGRect)rect { NULL, true); // Copy a portion of the image around the touch point. - float scale = 2.0f; + CGFloat scale = 2.0; CGRect box = CGRectMake( - touchPoint.x - ( ( _mask.size.width / scale ) / 2 ), - touchPoint.y - ( ( _mask.size.height / scale ) / 2 ), + touchPoint.x - ( ( _mask.size.width / scale ) / 2 ), + touchPoint.y - ( ( _mask.size.height / scale ) / 2 ), ( _mask.size.width / scale), ( _mask.size.height / scale ) ); + + CGFloat imageScale = _cache.scale; + box.origin.x *= imageScale; + box.origin.y *= imageScale; + box.size.width *= imageScale; + box.size.height *= imageScale; CGImageRef subImage = CGImageCreateWithImageInRect(imageRef, box); diff --git a/include/RichTextKit/RTKSelectionHandle.m b/include/RichTextKit/RTKSelectionHandle.m index 65a3635..cfd1849 100644 --- a/include/RichTextKit/RTKSelectionHandle.m +++ b/include/RichTextKit/RTKSelectionHandle.m @@ -36,7 +36,7 @@ - (id)initWithFrame:(CGRect)frame position:(RTKSelectionHandlePostition)position [self setBackgroundColor:[UIColor blueColor]]; _position = position; - _bull = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"RTKSelectionHandle.png"]] retain]; + _bull = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"RTKSelectionHandle.png"]]; [self addSubview:_bull]; @@ -44,11 +44,6 @@ - (id)initWithFrame:(CGRect)frame position:(RTKSelectionHandlePostition)position return self; } -- (void)dealloc { - [_bull release]; - [super dealloc]; -} - -(void)setCaretRect:(CGRect)rect; { [self setFrame:rect]; diff --git a/include/RichTextKit/RTKSelectionLoupeView.m b/include/RichTextKit/RTKSelectionLoupeView.m index 3e39786..45984ce 100644 --- a/include/RichTextKit/RTKSelectionLoupeView.m +++ b/include/RichTextKit/RTKSelectionLoupeView.m @@ -35,8 +35,8 @@ - (id)initWithFrame:(CGRect)frame { UIImage *mask = [UIImage imageNamed:@"RTKSelectionLoupeMask.png"]; if (self = [super initWithFrame:CGRectMake(0.0f, 0.0f, mask.size.width, mask.size.height)]) { self.backgroundColor = [UIColor clearColor]; - _mask = [mask retain]; - _loop = [[UIImage imageNamed:@"RTKSelectionLoupe.png"] retain]; + _mask = mask; + _loop = [UIImage imageNamed:@"RTKSelectionLoupe.png"]; } return self; } diff --git a/include/RichTextKit/RTKTextPosition.m b/include/RichTextKit/RTKTextPosition.m index 39f3a1d..426daff 100644 --- a/include/RichTextKit/RTKTextPosition.m +++ b/include/RichTextKit/RTKTextPosition.m @@ -36,7 +36,8 @@ + (id) positionWithInteger:(NSUInteger)pos; { RTKTextPosition *e = [[RTKTextPosition alloc] init]; e.position = pos; - return [e autorelease]; + + return e; } @end diff --git a/include/RichTextKit/RTKTextRange.m b/include/RichTextKit/RTKTextRange.m index 791711f..f0db105 100644 --- a/include/RichTextKit/RTKTextRange.m +++ b/include/RichTextKit/RTKTextRange.m @@ -34,7 +34,8 @@ + (id)rangeWithStart:(RTKTextPosition *)startPosition end:(RTKTextPosition *)end RTKTextRange *e = [[RTKTextRange alloc] init]; [e setStartPostion:startPosition]; [e setEndPostion:endPosition]; - return [e autorelease]; + + return e; } - (BOOL)isEmpty; @@ -54,7 +55,7 @@ - (UITextPosition *)start; - (void)setStartPostion:(RTKTextPosition *)position; { - _start = [position retain]; + _start = position; } - (UITextPosition *)end; @@ -64,7 +65,7 @@ - (UITextPosition *)end; - (void)setEndPostion:(RTKTextPosition *)position; { - _end = [position retain]; + _end = position; } #pragma mark - diff --git a/include/RichTextKit/RTKView.m b/include/RichTextKit/RTKView.m index b303fd0..8fcc4fc 100644 --- a/include/RichTextKit/RTKView.m +++ b/include/RichTextKit/RTKView.m @@ -56,15 +56,7 @@ - (id)initWithFrame:(CGRect)frame delegate:(id)docDel { return self; } -- (void)dealloc { - [docView release]; - [super dealloc]; -} - - #pragma mark - #pragma mark Touch Events - - @end diff --git a/main.m b/main.m index f570b14..1f85177 100644 --- a/main.m +++ b/main.m @@ -6,12 +6,10 @@ // Copyright 2010 TropicalPixels. All rights reserved. // -#import +#import "DemoAppDelegate.h" int main(int argc, char *argv[]) { - - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - int retVal = UIApplicationMain(argc, argv, nil, nil); - [pool release]; - return retVal; + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass(DemoAppDelegate.class)); + } }