fixbraces 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +56 -0
- data/Rakefile +14 -0
- data/bin/fixbraces +36 -0
- data/features/cli.feature +13 -0
- data/features/fixbraces.feature +22 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/AppDelegate.h +13 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/AppDelegate.m +44 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/Default-568h@2x.png +0 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/Default.png +0 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/Default@2x.png +0 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/DetailViewController.h +18 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/DetailViewController.m +49 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/FixbracesTestProject-Info.plist +50 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/FixbracesTestProject-Prefix.pch +14 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/MasterViewController.h +12 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/MasterViewController.m +111 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/en.lproj/InfoPlist.strings +2 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/en.lproj/MainStoryboard.storyboard +103 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/main.m +16 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject.xcodeproj/project.pbxproj +468 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProjectTests/FixbracesTestProjectTests-Info.plist +22 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProjectTests/FixbracesTestProjectTests.h +11 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProjectTests/FixbracesTestProjectTests.m +30 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProjectTests/en.lproj/InfoPlist.strings +2 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/AppDelegate.h +13 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/AppDelegate.m +38 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/Default-568h@2x.png +0 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/Default.png +0 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/Default@2x.png +0 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/DetailViewController.h +17 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/DetailViewController.m +45 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/FixbracesTestProject-Info.plist +50 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/FixbracesTestProject-Prefix.pch +14 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/MasterViewController.h +10 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/MasterViewController.m +99 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/en.lproj/InfoPlist.strings +2 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/en.lproj/MainStoryboard.storyboard +103 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/main.m +15 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject.xcodeproj/project.pbxproj +468 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProjectTests/FixbracesTestProjectTests-Info.plist +22 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProjectTests/FixbracesTestProjectTests.h +11 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProjectTests/FixbracesTestProjectTests.m +27 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProjectTests/en.lproj/InfoPlist.strings +2 -0
- data/features/step_definitions/cli_steps.rb +7 -0
- data/features/step_definitions/fixbraces_steps.rb +55 -0
- data/features/step_definitions/touch +0 -0
- data/features/support/env.rb +16 -0
- data/fixbraces.gemspec +28 -0
- data/lib/fixbraces/version.rb +3 -0
- data/lib/fixbraces.rb +25 -0
- data/spec/fixbraces_spec.rb +67 -0
- data/spec/fixtures/expected/AppDelegate.h +13 -0
- data/spec/fixtures/expected/AppDelegate.m +38 -0
- data/spec/fixtures/expected/MasterViewController.h +10 -0
- data/spec/fixtures/expected/MasterViewController.m +99 -0
- data/spec/fixtures/input/AppDelegate.h +13 -0
- data/spec/fixtures/input/AppDelegate.m +44 -0
- data/spec/fixtures/input/MasterViewController.h +12 -0
- data/spec/fixtures/input/MasterViewController.m +111 -0
- data/spec/fixtures/sample_text.rb +112 -0
- metadata +234 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Abizer Nasir
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Fixbraces
|
2
|
+
|
3
|
+
Make sure that the opening brace for an Objective-C code block is on the same
|
4
|
+
line.
|
5
|
+
|
6
|
+
Xcode is inconsistent about the placement of braces for code that it inserts for
|
7
|
+
us. Sometimes it puts the opening braces on the same line, sometimes it puts it
|
8
|
+
on the next line. I prefer it to be on the opening line.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
### From Rubygems
|
13
|
+
|
14
|
+
$ gem install fixbraces
|
15
|
+
|
16
|
+
### From source
|
17
|
+
|
18
|
+
Clone the repository and then build and install it:
|
19
|
+
|
20
|
+
rake install
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Once it is installed, you can run it from the command line. Either pass it the
|
25
|
+
current directory ('.') or a path to a directory that contains source
|
26
|
+
file. Alternatively, pass it a list of files.
|
27
|
+
|
28
|
+
You can pass it a directory:
|
29
|
+
|
30
|
+
fixbraces aDirectory
|
31
|
+
|
32
|
+
or even use '.' for the current directory:
|
33
|
+
|
34
|
+
fixbraces .
|
35
|
+
|
36
|
+
Apply it ot a single file:
|
37
|
+
|
38
|
+
fixbraces aDirectory/SourceFile.m
|
39
|
+
|
40
|
+
or a number of files:
|
41
|
+
|
42
|
+
fixbraces aDirectory/*.m
|
43
|
+
|
44
|
+
Run `fixbraces --help` for details.
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
1. Fork it
|
49
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
50
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
51
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
52
|
+
5. Create new Pull Request
|
53
|
+
|
54
|
+
## License
|
55
|
+
|
56
|
+
Standard MIT license. Knock yourself out.
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
require "rspec/core/rake_task"
|
4
|
+
require "rake/clean"
|
5
|
+
require "cucumber"
|
6
|
+
require "cucumber/rake/task"
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
9
|
+
|
10
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
11
|
+
t.cucumber_opts = "features --format pretty --no-source -x"
|
12
|
+
end
|
13
|
+
|
14
|
+
task :default => [:spec, :features]
|
data/bin/fixbraces
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "fixbraces"
|
4
|
+
require "trollop"
|
5
|
+
|
6
|
+
opts = Trollop::options do
|
7
|
+
version "v#{Fixbraces::VERSION}"
|
8
|
+
|
9
|
+
banner <<BANN
|
10
|
+
Puts the opening brace on the same line as the opening clause for Objective-C (.h and .m) files.
|
11
|
+
|
12
|
+
Usage:
|
13
|
+
fixbraces [options] files ...
|
14
|
+
|
15
|
+
where [options] are:
|
16
|
+
BANN
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
source_files = []
|
21
|
+
|
22
|
+
ARGV.each do |f|
|
23
|
+
f = File.expand_path f
|
24
|
+
extension = File.extname f
|
25
|
+
|
26
|
+
if File.directory? f
|
27
|
+
source_files.push Dir.glob File.join(f, "**/*.{h,m}")
|
28
|
+
elsif File.file? f and (extension == ".h" or extension == ".m")
|
29
|
+
source_files.push f
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
source_files.flatten.each do |f|
|
35
|
+
Fixbraces.process_file f
|
36
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: Help screens
|
2
|
+
In order to be easily used
|
3
|
+
The user will need useful help screens
|
4
|
+
|
5
|
+
Scenario: Version display
|
6
|
+
When I run `fixbraces -v`
|
7
|
+
Then version information should be displayed
|
8
|
+
And the exit status should be 0
|
9
|
+
|
10
|
+
Scenario: Help display
|
11
|
+
When I run `fixbraces -h`
|
12
|
+
Then usage information should be displayed
|
13
|
+
And the exit status should be 0
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Feature: The binary interface for fixbraces works
|
2
|
+
In order to be sure that the cli version of the gem works
|
3
|
+
The developer will need to make sure that these tests pass
|
4
|
+
|
5
|
+
Scenario: Run the app on a single file
|
6
|
+
Given a single source file called MasterViewController.m
|
7
|
+
When I run `fixbraces MasterViewController.m`
|
8
|
+
Then MasterViewController.m should be formatted correctly
|
9
|
+
And the exit status should be 0
|
10
|
+
|
11
|
+
Scenario: Run the app on a directory
|
12
|
+
Given an Xcode project
|
13
|
+
When I run `"fixbraces ."`
|
14
|
+
Then the files in the directory should be formatted correctly
|
15
|
+
And the exit status should be 0
|
16
|
+
|
17
|
+
Scenario: Run the app on a number of files in the directory
|
18
|
+
Given an Xcode project
|
19
|
+
When I run `"fixbraces FixbracesTestProject/*.m"`
|
20
|
+
Then the .m files in that directory are changed
|
21
|
+
And the .h files in that directory are unchanged
|
22
|
+
And the exit status should be 0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
//
|
2
|
+
// AppDelegate.m
|
3
|
+
// FixbracesTestProject
|
4
|
+
//
|
5
|
+
//
|
6
|
+
|
7
|
+
#import "AppDelegate.h"
|
8
|
+
|
9
|
+
@implementation AppDelegate
|
10
|
+
|
11
|
+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
12
|
+
{
|
13
|
+
// Override point for customization after application launch.
|
14
|
+
return YES;
|
15
|
+
}
|
16
|
+
|
17
|
+
- (void)applicationWillResignActive:(UIApplication *)application
|
18
|
+
{
|
19
|
+
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
20
|
+
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
21
|
+
}
|
22
|
+
|
23
|
+
- (void)applicationDidEnterBackground:(UIApplication *)application
|
24
|
+
{
|
25
|
+
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
26
|
+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
27
|
+
}
|
28
|
+
|
29
|
+
- (void)applicationWillEnterForeground:(UIApplication *)application
|
30
|
+
{
|
31
|
+
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
32
|
+
}
|
33
|
+
|
34
|
+
- (void)applicationDidBecomeActive:(UIApplication *)application
|
35
|
+
{
|
36
|
+
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
37
|
+
}
|
38
|
+
|
39
|
+
- (void)applicationWillTerminate:(UIApplication *)application
|
40
|
+
{
|
41
|
+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
42
|
+
}
|
43
|
+
|
44
|
+
@end
|
Binary file
|
@@ -0,0 +1,18 @@
|
|
1
|
+
//
|
2
|
+
// DetailViewController.h
|
3
|
+
// FixbracesTestProject
|
4
|
+
//
|
5
|
+
//
|
6
|
+
|
7
|
+
#import <UIKit/UIKit.h>
|
8
|
+
|
9
|
+
@interface DetailViewController : UIViewController
|
10
|
+
{
|
11
|
+
NSString *_unusedStringIVar;
|
12
|
+
NSArray *_unuasedArrayIVar;
|
13
|
+
}
|
14
|
+
|
15
|
+
@property (strong, nonatomic) id detailItem;
|
16
|
+
|
17
|
+
@property (weak, nonatomic) IBOutlet UILabel *detailDescriptionLabel;
|
18
|
+
@end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
//
|
2
|
+
// DetailViewController.m
|
3
|
+
// FixbracesTestProject
|
4
|
+
//
|
5
|
+
//
|
6
|
+
|
7
|
+
#import "DetailViewController.h"
|
8
|
+
|
9
|
+
@interface DetailViewController ()
|
10
|
+
- (void)configureView;
|
11
|
+
@end
|
12
|
+
|
13
|
+
@implementation DetailViewController
|
14
|
+
|
15
|
+
#pragma mark - Managing the detail item
|
16
|
+
|
17
|
+
- (void)setDetailItem:(id)newDetailItem
|
18
|
+
{
|
19
|
+
if (_detailItem != newDetailItem) {
|
20
|
+
_detailItem = newDetailItem;
|
21
|
+
|
22
|
+
// Update the view.
|
23
|
+
[self configureView];
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
- (void)configureView
|
28
|
+
{
|
29
|
+
// Update the user interface for the detail item.
|
30
|
+
|
31
|
+
if (self.detailItem) {
|
32
|
+
self.detailDescriptionLabel.text = [self.detailItem description];
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
- (void)viewDidLoad
|
37
|
+
{
|
38
|
+
[super viewDidLoad];
|
39
|
+
// Do any additional setup after loading the view, typically from a nib.
|
40
|
+
[self configureView];
|
41
|
+
}
|
42
|
+
|
43
|
+
- (void)didReceiveMemoryWarning
|
44
|
+
{
|
45
|
+
[super didReceiveMemoryWarning];
|
46
|
+
// Dispose of any resources that can be recreated.
|
47
|
+
}
|
48
|
+
|
49
|
+
@end
|
data/features/fixtures/FixbracesTestProject/FixbracesTestProject/FixbracesTestProject-Info.plist
ADDED
@@ -0,0 +1,50 @@
|
|
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>CFBundleDevelopmentRegion</key>
|
6
|
+
<string>en</string>
|
7
|
+
<key>CFBundleDisplayName</key>
|
8
|
+
<string>${PRODUCT_NAME}</string>
|
9
|
+
<key>CFBundleExecutable</key>
|
10
|
+
<string>${EXECUTABLE_NAME}</string>
|
11
|
+
<key>CFBundleIdentifier</key>
|
12
|
+
<string>com.junglecandy.${PRODUCT_NAME:rfc1034identifier}</string>
|
13
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
14
|
+
<string>6.0</string>
|
15
|
+
<key>CFBundleName</key>
|
16
|
+
<string>${PRODUCT_NAME}</string>
|
17
|
+
<key>CFBundlePackageType</key>
|
18
|
+
<string>APPL</string>
|
19
|
+
<key>CFBundleShortVersionString</key>
|
20
|
+
<string>1.0</string>
|
21
|
+
<key>CFBundleSignature</key>
|
22
|
+
<string>????</string>
|
23
|
+
<key>CFBundleVersion</key>
|
24
|
+
<string>1.0</string>
|
25
|
+
<key>LSRequiresIPhoneOS</key>
|
26
|
+
<true/>
|
27
|
+
<key>UIMainStoryboardFile</key>
|
28
|
+
<string>MainStoryboard</string>
|
29
|
+
<key>UIRequiredDeviceCapabilities</key>
|
30
|
+
<array>
|
31
|
+
<string>armv7</string>
|
32
|
+
</array>
|
33
|
+
<key>UIStatusBarTintParameters</key>
|
34
|
+
<dict>
|
35
|
+
<key>UINavigationBar</key>
|
36
|
+
<dict>
|
37
|
+
<key>Style</key>
|
38
|
+
<string>UIBarStyleDefault</string>
|
39
|
+
<key>Translucent</key>
|
40
|
+
<false/>
|
41
|
+
</dict>
|
42
|
+
</dict>
|
43
|
+
<key>UISupportedInterfaceOrientations</key>
|
44
|
+
<array>
|
45
|
+
<string>UIInterfaceOrientationPortrait</string>
|
46
|
+
<string>UIInterfaceOrientationLandscapeLeft</string>
|
47
|
+
<string>UIInterfaceOrientationLandscapeRight</string>
|
48
|
+
</array>
|
49
|
+
</dict>
|
50
|
+
</plist>
|
data/features/fixtures/FixbracesTestProject/FixbracesTestProject/FixbracesTestProject-Prefix.pch
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
//
|
2
|
+
// Prefix header for all source files of the 'FixbracesTestProject' target in the 'FixbracesTestProject' project
|
3
|
+
//
|
4
|
+
|
5
|
+
#import <Availability.h>
|
6
|
+
|
7
|
+
#ifndef __IPHONE_5_0
|
8
|
+
#warning "This project uses features only available in iOS SDK 5.0 and later."
|
9
|
+
#endif
|
10
|
+
|
11
|
+
#ifdef __OBJC__
|
12
|
+
#import <UIKit/UIKit.h>
|
13
|
+
#import <Foundation/Foundation.h>
|
14
|
+
#endif
|
@@ -0,0 +1,111 @@
|
|
1
|
+
//
|
2
|
+
// MasterViewController.m
|
3
|
+
// FixbracesTestProject
|
4
|
+
//
|
5
|
+
//
|
6
|
+
|
7
|
+
#import "MasterViewController.h"
|
8
|
+
|
9
|
+
#import "DetailViewController.h"
|
10
|
+
|
11
|
+
@interface MasterViewController () {
|
12
|
+
NSMutableArray *_objects;
|
13
|
+
}
|
14
|
+
@end
|
15
|
+
|
16
|
+
@implementation MasterViewController
|
17
|
+
|
18
|
+
- (void)awakeFromNib
|
19
|
+
{
|
20
|
+
[super awakeFromNib];
|
21
|
+
}
|
22
|
+
|
23
|
+
- (void)viewDidLoad
|
24
|
+
{
|
25
|
+
[super viewDidLoad];
|
26
|
+
// Do any additional setup after loading the view, typically from a nib.
|
27
|
+
self.navigationItem.leftBarButtonItem = self.editButtonItem;
|
28
|
+
|
29
|
+
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)];
|
30
|
+
self.navigationItem.rightBarButtonItem = addButton;
|
31
|
+
}
|
32
|
+
|
33
|
+
- (void)didReceiveMemoryWarning
|
34
|
+
{
|
35
|
+
[super didReceiveMemoryWarning];
|
36
|
+
// Dispose of any resources that can be recreated.
|
37
|
+
}
|
38
|
+
|
39
|
+
- (void)insertNewObject:(id)sender
|
40
|
+
{
|
41
|
+
if (!_objects) {
|
42
|
+
_objects = [[NSMutableArray alloc] init];
|
43
|
+
}
|
44
|
+
[_objects insertObject:[NSDate date] atIndex:0];
|
45
|
+
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
|
46
|
+
[self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
|
47
|
+
}
|
48
|
+
|
49
|
+
#pragma mark - Table View
|
50
|
+
|
51
|
+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
52
|
+
{
|
53
|
+
return 1;
|
54
|
+
}
|
55
|
+
|
56
|
+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
57
|
+
{
|
58
|
+
return _objects.count;
|
59
|
+
}
|
60
|
+
|
61
|
+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
62
|
+
{
|
63
|
+
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
|
64
|
+
|
65
|
+
NSDate *object = _objects[indexPath.row];
|
66
|
+
cell.textLabel.text = [object description];
|
67
|
+
return cell;
|
68
|
+
}
|
69
|
+
|
70
|
+
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
|
71
|
+
{
|
72
|
+
// Return NO if you do not want the specified item to be editable.
|
73
|
+
return YES;
|
74
|
+
}
|
75
|
+
|
76
|
+
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
|
77
|
+
{
|
78
|
+
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
79
|
+
[_objects removeObjectAtIndex:indexPath.row];
|
80
|
+
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
|
81
|
+
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
|
82
|
+
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
/*
|
87
|
+
// Override to support rearranging the table view.
|
88
|
+
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
|
89
|
+
{
|
90
|
+
}
|
91
|
+
*/
|
92
|
+
|
93
|
+
/*
|
94
|
+
// Override to support conditional rearranging of the table view.
|
95
|
+
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
|
96
|
+
{
|
97
|
+
// Return NO if you do not want the item to be re-orderable.
|
98
|
+
return YES;
|
99
|
+
}
|
100
|
+
*/
|
101
|
+
|
102
|
+
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
|
103
|
+
{
|
104
|
+
if ([[segue identifier] isEqualToString:@"showDetail"]) {
|
105
|
+
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
|
106
|
+
NSDate *object = _objects[indexPath.row];
|
107
|
+
[[segue destinationViewController] setDetailItem:object];
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
@end
|
data/features/fixtures/FixbracesTestProject/FixbracesTestProject/en.lproj/MainStoryboard.storyboard
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="2524" systemVersion="12A217" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="3">
|
3
|
+
<dependencies>
|
4
|
+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1863"/>
|
5
|
+
</dependencies>
|
6
|
+
<scenes>
|
7
|
+
<!--Navigation Controller-->
|
8
|
+
<scene sceneID="11">
|
9
|
+
<objects>
|
10
|
+
<navigationController id="3" sceneMemberID="viewController">
|
11
|
+
<navigationBar key="navigationBar" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="4">
|
12
|
+
<autoresizingMask key="autoresizingMask"/>
|
13
|
+
</navigationBar>
|
14
|
+
<connections>
|
15
|
+
<segue destination="12" kind="relationship" relationship="rootViewController" id="19"/>
|
16
|
+
</connections>
|
17
|
+
</navigationController>
|
18
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="10" sceneMemberID="firstResponder"/>
|
19
|
+
</objects>
|
20
|
+
<point key="canvasLocation" x="-1" y="64"/>
|
21
|
+
</scene>
|
22
|
+
<!--class Prefix:identifier Master View Controller - Master-->
|
23
|
+
<scene sceneID="18">
|
24
|
+
<objects>
|
25
|
+
<tableViewController storyboardIdentifier="" title="Master" id="12" customClass="MasterViewController" sceneMemberID="viewController">
|
26
|
+
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="13">
|
27
|
+
<rect key="frame" x="0.0" y="64" width="320" height="416"/>
|
28
|
+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
29
|
+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
30
|
+
<prototypes>
|
31
|
+
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="phq-AM-6qj" style="IBUITableViewCellStyleDefault" id="lJ0-d7-vTF">
|
32
|
+
<rect key="frame" x="0.0" y="22" width="320" height="44"/>
|
33
|
+
<autoresizingMask key="autoresizingMask"/>
|
34
|
+
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
|
35
|
+
<rect key="frame" x="0.0" y="0.0" width="300" height="43"/>
|
36
|
+
<autoresizingMask key="autoresizingMask"/>
|
37
|
+
<subviews>
|
38
|
+
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" lineBreakMode="tailTruncation" autoshrinkMode="none" baselineAdjustment="alignBaselines" text="Title" adjustsFontSizeToFit="NO" id="phq-AM-6qj">
|
39
|
+
<rect key="frame" x="10" y="0.0" width="280" height="43"/>
|
40
|
+
<autoresizingMask key="autoresizingMask"/>
|
41
|
+
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
42
|
+
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
43
|
+
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
|
44
|
+
</label>
|
45
|
+
</subviews>
|
46
|
+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
47
|
+
</view>
|
48
|
+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
49
|
+
<connections>
|
50
|
+
<segue destination="21" kind="push" identifier="showDetail" id="jZb-fq-zAk"/>
|
51
|
+
</connections>
|
52
|
+
</tableViewCell>
|
53
|
+
</prototypes>
|
54
|
+
<sections/>
|
55
|
+
<connections>
|
56
|
+
<outlet property="dataSource" destination="12" id="16"/>
|
57
|
+
<outlet property="delegate" destination="12" id="15"/>
|
58
|
+
</connections>
|
59
|
+
</tableView>
|
60
|
+
<navigationItem key="navigationItem" title="Master" id="36"/>
|
61
|
+
</tableViewController>
|
62
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="17" sceneMemberID="firstResponder"/>
|
63
|
+
</objects>
|
64
|
+
<point key="canvasLocation" x="459" y="64"/>
|
65
|
+
</scene>
|
66
|
+
<!--class Prefix:identifier Detail View Controller - Detail-->
|
67
|
+
<scene sceneID="24">
|
68
|
+
<objects>
|
69
|
+
<viewController storyboardIdentifier="" title="Detail" id="21" customClass="DetailViewController" sceneMemberID="viewController">
|
70
|
+
<view key="view" contentMode="scaleToFill" id="22">
|
71
|
+
<rect key="frame" x="0.0" y="64" width="320" height="416"/>
|
72
|
+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
73
|
+
<subviews>
|
74
|
+
<label translatesAutoresizingMaskIntoConstraints="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" lineBreakMode="tailTruncation" autoshrinkMode="none" minimumFontSize="10" text="Detail view content goes here" textAlignment="center" id="27">
|
75
|
+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
76
|
+
<nil key="highlightedColor"/>
|
77
|
+
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
78
|
+
<fontDescription key="fontDescription" type="system" size="system"/>
|
79
|
+
</label>
|
80
|
+
</subviews>
|
81
|
+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
82
|
+
<constraints>
|
83
|
+
<constraint firstItem="27" firstAttribute="centerY" secondItem="22" secondAttribute="centerY" type="default" id="7cE-gL-0wv"/>
|
84
|
+
<constraint firstItem="27" firstAttribute="leading" secondItem="22" secondAttribute="leading" constant="20" symbolic="YES" type="default" id="R0m-z7-TWk"/>
|
85
|
+
<constraint firstAttribute="trailing" secondItem="27" secondAttribute="trailing" constant="20" symbolic="YES" type="default" id="pRe-qY-58T"/>
|
86
|
+
</constraints>
|
87
|
+
</view>
|
88
|
+
<navigationItem key="navigationItem" title="Detail" id="26"/>
|
89
|
+
<connections>
|
90
|
+
<outlet property="detailDescriptionLabel" destination="27" id="28"/>
|
91
|
+
</connections>
|
92
|
+
</viewController>
|
93
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="23" sceneMemberID="firstResponder"/>
|
94
|
+
</objects>
|
95
|
+
<point key="canvasLocation" x="902" y="64"/>
|
96
|
+
</scene>
|
97
|
+
</scenes>
|
98
|
+
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
99
|
+
<simulatedStatusBarMetrics key="statusBar"/>
|
100
|
+
<simulatedOrientationMetrics key="orientation"/>
|
101
|
+
<simulatedScreenMetrics key="destination" type="retina4"/>
|
102
|
+
</simulatedMetricsContainer>
|
103
|
+
</document>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
//
|
2
|
+
// main.m
|
3
|
+
// FixbracesTestProject
|
4
|
+
//
|
5
|
+
//
|
6
|
+
|
7
|
+
#import <UIKit/UIKit.h>
|
8
|
+
|
9
|
+
#import "AppDelegate.h"
|
10
|
+
|
11
|
+
int main(int argc, char *argv[])
|
12
|
+
{
|
13
|
+
@autoreleasepool {
|
14
|
+
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
15
|
+
}
|
16
|
+
}
|