Q:

Objective-C syntax error - unexpected "@" / unable to fix problems

enter code here[youtube picture of the same code][1]I keep getting an error with my code where it says 

"unexpected "@" in program and also missing "@end"

If you look at the code below the @end is there but however much I retype it the answer is the same "missing @end"
Here is the full code 
#import "MasterViewController.h"
#import "DetailViewController.h"

@interface MasterViewController ()

@end

@implementation MasterViewController
-(NSMutableArray *) objects

{
if (!_objects){
_objects =[[NSMutableArray alloc]init];
}
return _objects;
}

-(NSMutableArray *) results
{
if (!_results) {
_results =[[NSMutableArray alloc]init];
}
return _results;
}
-(void)viewDidLoad
{
[super viewDidLoad];

[self.objects addObject:@"Tabebuia yellow"];
[self.objects addObject:@"Prunus armeniaca"];
[self.objects addObject:@"Tabebuia rosea"];

}
-(void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void) searchThroughData
{
self.results= nil;
NSPredicate * resultsPredicate = [NSPredicate predicateWithFormat:@"SELF contains [search]%@", self.searchBar.text];
self. results = [[ self.objects filteredArrayUsingPredicate:resultsPredicate]mutableCopy];
}
-(void) searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
[self searchThroughData];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (tableView == self.tableView)
{
return self.objects.count;

}else{

[self searchThroughData];
return self.results.count;
}
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString  *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (!cell)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: CellIdentifier];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}

if (tableView == self.tableView){
cell.textLabel.text = self.objects[indexPath.row];

} else {
cell.textLabel.text = self.results[indexPath.row];

}
return cell;
}

    -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (self.searchController.isActive)
{

[self performSegueWithIdentifier:@"Showdetail" sender:self];

}

-(void) PrepareForSegue:(UIStoryboardSegue *) segue sender:(id) sender

if ([[ segue identifier] isEqualToString:@"ShowDetail"]) {

NSString *object = nil;
NSIndexPath *Indexpath = nil;

if (self.UISearchController.isActive)
{UISearchController
    Indexpath = [[ self.searchController searchResultsTableView]indexPathForSelectedRow];
    object = self.results [Indexpath.row];
}else{

       Indexpath = [self.tableView indexPathForSelectedRow];
object = [[self.objects [Indexpath.row];

    [segue destinationViewController] setDetailLabelContents:object];
}}

@end

A:

You have no closing } at the end of the prepareForSegue:sender: method. Formatting and indenting properly makes this clear.
You have code just floating outside of a method (the lines before the tableView:didSelectRowAtIndexPath: method.

There needs to be a proper pairing of { and } and code needs to be inside methods or functions.

