diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8565726
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,34 @@
+### Xcode ###
+# Xcode
+#
+# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
+
+## Build generated
+build/
+DerivedData/
+
+## Various settings
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+xcuserdata/
+
+## Other
+*.moved-aside
+*.xccheckout
+*.xcscmblueprint
+
+### Xcode Patch ###
+*.xcodeproj/*
+!*.xcodeproj/project.pbxproj
+!*.xcodeproj/xcshareddata/
+!*.xcworkspace/contents.xcworkspacedata
+/*.gcno
+
+# End of https://www.gitignore.io/api/xcode
+
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..5d56cd1
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,13 @@
+os: osx
+osx_image: xcode9.1
+
+language: objective-c
+
+xcode_project: iMeme.xcodeproj
+xcode_scheme: iMeme
+
+# https://stackoverflow.com/questions/41786984/error-unexpected-action-build-when-building-a-project-with-swift-3-and-cocoa
+# prevents 'ERROR: Unexpected action: build'
+script:
+ - xcodebuild clean build -sdk iphonesimulator -workspace Project.xcworkspace -scheme ProjectTests CODE_SIGNING_REQUIRED=NO
+
diff --git a/iMeme.xcodeproj/xcshareddata/xcschemes/iMeme.xcscheme b/iMeme.xcodeproj/xcshareddata/xcschemes/iMeme.xcscheme
new file mode 100644
index 0000000..0b229dc
--- /dev/null
+++ b/iMeme.xcodeproj/xcshareddata/xcschemes/iMeme.xcscheme
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/iMeme/TableViewController.h b/iMeme/TableViewController.h
index 2b7d9b5..3e94e15 100644
--- a/iMeme/TableViewController.h
+++ b/iMeme/TableViewController.h
@@ -10,11 +10,14 @@
#import "AppDelegate.h"
@interface TableViewController : NSObject {
- NSMutableArray* items;
+ NSMutableArray* allItems;
+ NSArray* filteredItems;
AppDelegate* appDelegate;
NSTableView* tableView;
+ NSSearchField *searchField;
}
+@property (assign) IBOutlet NSSearchField *searchField;
@property (assign) IBOutlet AppDelegate* appDelegate;
@property (assign) IBOutlet NSTableView* tableView;
diff --git a/iMeme/TableViewController.m b/iMeme/TableViewController.m
index b7af413..40620ef 100644
--- a/iMeme/TableViewController.m
+++ b/iMeme/TableViewController.m
@@ -11,30 +11,32 @@
@implementation TableViewController
+@synthesize searchField;
@synthesize appDelegate;
@synthesize tableView;
- (id)init {
self = [super init];
if (self) {
- items = [[NSMutableArray alloc] init];
+ allItems = [[NSMutableArray alloc] init];
NSArray* paths = [[NSBundle mainBundle] pathsForResourcesOfType:@"jpg" inDirectory:nil];
for (NSString* filename in paths) {
NSString* path = [[filename lastPathComponent] stringByDeletingPathExtension];
NSString* name = [path stringByReplacingOccurrencesOfString:@"-" withString:@" "];
path = [[NSBundle mainBundle] pathForImageResource:path];
- [items addObject:[[Template alloc] initWithName:name path:path]];
+ [allItems addObject:[[Template alloc] initWithName:name path:path]];
}
+ filteredItems = allItems.copy;
}
return self;
}
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
- return [items count];
+ return [filteredItems count];
}
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
- Template* template = [items objectAtIndex:row];
+ Template* template = [filteredItems objectAtIndex:row];
NSString* identifier = [tableColumn identifier];
return [template valueForKey:identifier];
}
@@ -42,9 +44,20 @@ - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColum
- (void)tableViewSelectionDidChange:(NSNotification *)notification {
NSInteger row = [tableView selectedRow];
if (row >= 0) {
- Template* template = [items objectAtIndex:row];
+ Template* template = [filteredItems objectAtIndex:row];
[appDelegate setPath:[template path]];
}
}
+- (IBAction)updateFilter:(id)sender {
+ NSString *filter = [self.searchField stringValue];
+ if (filter.length > 0) {
+ NSPredicate *filterPredicate = [NSPredicate predicateWithFormat:@"self.name CONTAINS[cd] %@", filter];
+ filteredItems = [[allItems filteredArrayUsingPredicate:filterPredicate] mutableCopy];
+ } else {
+ filteredItems = allItems.copy;
+ }
+ [self.tableView reloadData];
+}
+
@end
diff --git a/iMeme/en.lproj/MainMenu.xib b/iMeme/en.lproj/MainMenu.xib
index b7df660..aa75374 100644
--- a/iMeme/en.lproj/MainMenu.xib
+++ b/iMeme/en.lproj/MainMenu.xib
@@ -1,2583 +1,485 @@
-
-
- 1080
- 12C60
- 2843
- 1187.34
- 625.00
-
-
- NSCustomObject
- NSImageCell
- NSImageView
- NSMenu
- NSMenuItem
- NSScrollView
- NSScroller
- NSSegmentedCell
- NSSegmentedControl
- NSTableColumn
- NSTableView
- NSTextField
- NSTextFieldCell
- NSToolbar
- NSToolbarFlexibleSpaceItem
- NSToolbarItem
- NSToolbarSeparatorItem
- NSToolbarSpaceItem
- NSView
- NSWindowTemplate
-
-
- com.apple.InterfaceBuilder.CocoaPlugin
-
-
-
-
-
-
-
-
-
- AppDelegate
-
-
- NSFontManager
-
-
- TableViewController
-
-
-
-
-
-
- terminate:
-
-
-
- 449
-
-
-
- orderFrontStandardAboutPanel:
-
-
-
- 142
-
-
-
- delegate
-
-
-
- 495
-
-
-
- performMiniaturize:
-
-
-
- 37
-
-
-
- arrangeInFront:
-
-
-
- 39
-
-
-
- runPageLayout:
-
-
-
- 87
-
-
-
- performClose:
-
-
-
- 193
-
-
-
- performZoom:
-
-
-
- 240
-
-
-
- runToolbarCustomizationPalette:
-
-
-
- 365
-
-
-
- toggleToolbarShown:
-
-
-
- 366
-
-
-
- hide:
-
-
-
- 367
-
-
-
- hideOtherApplications:
-
-
-
- 368
-
-
-
- unhideAllApplications:
-
-
-
- 370
-
-
-
- showHelp:
-
-
-
- 493
-
-
-
- redo:
-
-
-
- 231
-
-
-
- copy:
-
-
-
- 224
-
-
-
- paste:
-
-
-
- 226
-
-
-
- cut:
-
-
-
- 228
-
-
-
- undo:
-
-
-
- 223
-
-
-
- selectAll:
-
-
-
- 232
-
-
-
- delete:
-
-
-
- 235
-
-
-
- initialFirstResponder
-
-
-
- 563
-
-
-
- window
-
-
-
- 532
-
-
-
- imageView
-
-
-
- 578
-
-
-
- header
-
-
-
- 583
-
-
-
- footer
-
-
-
- 584
-
-
-
- onHeaderSize:
-
-
-
- 585
-
-
-
- onFooterSize:
-
-
-
- 586
-
-
-
- onHeaderAlignment:
-
-
-
- 587
-
-
-
- onFooterAlignment:
-
-
-
- 588
-
-
-
- headerAlignment
-
-
-
- 591
-
-
-
- footerAlignment
-
-
-
- 592
-
-
-
- onOpen:
-
-
-
- 624
-
-
-
- onSave:
-
-
-
- 625
-
-
-
- onReset:
-
-
-
- 626
-
-
-
- onImgur:
-
-
-
- 627
-
-
-
- onReddit:
-
-
-
- 628
-
-
-
- onCopy:
-
-
-
- 631
-
-
-
- onOpen:
-
-
-
- 633
-
-
-
- onSave:
-
-
-
- 634
-
-
-
- onReset:
-
-
-
- 635
-
-
-
- onWebsite:
-
-
-
- 639
-
-
-
- tableView
-
-
-
- 640
-
-
-
- print:
-
-
-
- 632
-
-
-
- print:
-
-
-
- 637
-
-
-
- nextKeyView
-
-
-
- 564
-
-
-
- delegate
-
-
-
- 574
-
-
-
- dataSource
-
-
-
- 575
-
-
-
- nextKeyView
-
-
-
- 566
-
-
-
- delegate
-
-
-
- 582
-
-
-
- nextKeyView
-
-
-
- 565
-
-
-
- delegate
-
-
-
- 581
-
-
-
- nextKeyView
-
-
-
- 569
-
-
-
- nextKeyView
-
-
-
- 629
-
-
-
- nextKeyView
-
-
-
- 567
-
-
-
- nextKeyView
-
-
-
- 568
-
-
-
- tableView
-
-
-
- 576
-
-
-
- appDelegate
-
-
-
- 577
-
-
-
-
-
- 0
-
-
-
-
-
- -2
-
-
- File's Owner
-
-
- -1
-
-
- First Responder
-
-
- -3
-
-
- Application
-
-
- 29
-
-
-
-
-
-
-
-
-
-
-
-
- 19
-
-
-
-
-
-
-
- 56
-
-
-
-
-
-
-
- 83
-
-
-
-
-
-
-
- 81
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 75
-
-
-
-
- 78
-
-
-
-
- 72
-
-
-
-
- 82
-
-
-
-
- 77
-
-
-
-
- 73
-
-
-
-
- 79
-
-
-
-
- 74
-
-
-
-
- 57
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 58
-
-
-
-
- 134
-
-
-
-
- 150
-
-
-
-
- 136
-
-
-
-
- 144
-
-
-
-
- 129
-
-
-
-
- 143
-
-
-
-
- 236
-
-
-
-
- 131
-
-
-
-
-
-
-
- 149
-
-
-
-
- 145
-
-
-
-
- 130
-
-
-
-
- 24
-
-
-
-
-
-
-
-
-
-
- 92
-
-
-
-
- 5
-
-
-
-
- 239
-
-
-
-
- 23
-
-
-
-
- 295
-
-
-
-
-
-
-
- 296
-
-
-
-
-
-
-
-
- 297
-
-
-
-
- 298
-
-
-
-
- 371
-
-
-
-
-
-
-
-
- 372
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 420
-
-
-
-
- 490
-
-
-
-
-
-
-
- 491
-
-
-
-
-
-
-
- 492
-
-
-
-
- 494
-
-
-
-
- 536
-
-
-
-
-
-
-
- 537
-
-
-
-
- 538
-
-
-
-
-
-
-
-
-
- 539
-
-
-
-
-
-
-
- 540
-
-
-
-
- 542
-
-
-
-
- 543
-
-
-
-
-
-
-
- 546
-
-
-
-
- 547
-
-
-
-
-
-
-
- 548
-
-
-
-
- 549
-
-
-
-
-
-
-
- 550
-
-
-
-
- 555
-
-
-
-
-
-
-
- 556
-
-
-
-
- 557
-
-
-
-
-
-
-
- 558
-
-
-
-
- 559
-
-
-
-
-
-
-
- 560
-
-
-
-
- 561
-
-
-
-
-
-
-
- 562
-
-
-
-
- 573
-
-
-
-
- 610
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 614
-
-
-
-
- 615
-
-
-
-
- 616
-
-
-
-
- 617
-
-
-
-
- 619
-
-
-
-
- 620
-
-
-
-
- 621
-
-
-
-
- 622
-
-
-
-
- 623
-
-
-
-
- 630
-
-
-
-
- 636
-
-
-
-
- 217
-
-
-
-
-
-
-
- 205
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 215
-
-
-
-
- 206
-
-
-
-
- 197
-
-
-
-
- 203
-
-
-
-
- 199
-
-
-
-
- 207
-
-
-
-
- 198
-
-
-
-
- 202
-
-
-
-
- 638
-
-
-
-
-
-
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
-
-
- com.apple.InterfaceBuilder.CocoaPlugin
- {{380, 496}, {480, 360}}
-
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
-
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
-
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
-
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
-
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
-
-
-
-
-
- 640
-
-
-
-
- AppDelegate
- NSObject
-
- id
- id
- NSSegmentedControl
- NSSegmentedControl
- NSSegmentedControl
- NSSegmentedControl
- id
- id
- id
- id
- id
- id
-
-
-
- copy:
- id
-
-
- onCopy:
- id
-
-
- onFooterAlignment:
- NSSegmentedControl
-
-
- onFooterSize:
- NSSegmentedControl
-
-
- onHeaderAlignment:
- NSSegmentedControl
-
-
- onHeaderSize:
- NSSegmentedControl
-
-
- onImgur:
- id
-
-
- onOpen:
- id
-
-
- onReddit:
- id
-
-
- onReset:
- id
-
-
- onSave:
- id
-
-
- onWebsite:
- id
-
-
-
- NSTextField
- NSSegmentedControl
- NSTextField
- NSSegmentedControl
- NSImageView
- NSTableView
- NSWindow
-
-
-
- footer
- NSTextField
-
-
- footerAlignment
- NSSegmentedControl
-
-
- header
- NSTextField
-
-
- headerAlignment
- NSSegmentedControl
-
-
- imageView
- NSImageView
-
-
- tableView
- NSTableView
-
-
- window
- NSWindow
-
-
-
- IBProjectSource
- ./Classes/AppDelegate.h
-
-
-
- TableViewController
- NSObject
-
- AppDelegate
- NSTableView
-
-
-
- appDelegate
- AppDelegate
-
-
- tableView
- NSTableView
-
-
-
- IBProjectSource
- ./Classes/TableViewController.h
-
-
-
-
- 0
- IBCocoaFramework
- YES
- 3
-
- {11, 11}
- {10, 3}
- {32, 32}
- {16, 16}
- {16, 16}
- {16, 16}
- {102.40000000000001, 102.40000000000001}
- {32, 32}
- {32.395949255088134, 32.395949255088134}
- {8, 8}
- {102.40000000000001, 102.40000000000001}
- {102.40000000000001, 102.40000000000001}
- {8, 8}
- {102.40000000000001, 102.40000000000001}
- {32, 32}
- {102.40000000000001, 102.40000000000001}
- {500, 500}
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+