Puzzpic : Share Puzzles


Puzzpic

Share, Solve, And Have Fun 🎉

Puzzpic

WHAT IS PUZZPIC

Puzzpic is an amazing app to share images with a riddle where users can post an image and it get shuffled as a challenge for others to solve. And you can explore others’ puzzles and solve them to gain the original Images.

The Idea

You Get what You Solve.

You have a time limit for each puzzle where you thrive to solve the puzzle.
If you make it !! you get the solved Image and have the power to save it or share it as a prize.
Otherwise you lose it and you won’t be able to see it again!!.

Sounds Fun right !!! 😀 😀

Features

Here I will talk about the features you get in the app and how to use them.

Login/Register

Simulator Screen Shot May 16, 2016, 10.54.12 PMWe need you to register first in the app which will allow you to Post Puzzles, like puzzles , follow other users, and to be identified when you solve a puzzle, and give you Points.

In version 1.1 you can Login with Facebook as well. Although the normal register/Login is simple since all am asking for is an email, username, and a password.

Explore Puzzles

In the main Screen, you can view other users or your puzzles categorized in three categories.

MainLATEST

Where the latest updated puzzles appear, these puzzles are public.

TOP

Where the most liked puzzles in the last 7 days(although this may change) appears. These puzzles also are public.

Following

Where puzzles of the users you follow appear, these puzzles might be public or set to be only to Followers.

You can solve and/or like any of these puzzles unless they are yours then you only can like them.

SOLVER

SolverWhen you tap on the Solve button under a puzzle of your choice you get the SOLVER Screen, which is a very simple screen , where you will see a shuffled image and try to solve it within the time limit.

You can swap any two blocks (not only adjacent)of the image by Tapping on each Block. Dragging is not supported right now but It’s on the RoadMap.

If you Solve it by the time the image will not be shown anymore in the Explore (main) screen and will be shown in a different screen called Solved-puzzles screen where you can access it from the Left Menu.

Otherwise the puzzle will be deleted from the main screen and not shown anymore!! 🙁 .

THE MAKER

 

makerThe Maker Screen is where you create your own puzzle and it’s dead simple with a nice design.

You can access this screen by tapping on the plus button in the main screen.

You will see the camera running in a box which exactly the size of the puzzle.

Above The Camera Box there is a Level chooser , you need to choose the level before taking the image since the Camera Box will resize based on the chosen level.

You can Snap the Image by tapping on the big circular button, and then magically the image will be shuffled instantly and the upload button along with other button will appear, I call it the Editing Box where you can add caption or shuffle the puzzle again or retake it or upload the puzzle.

 Always add caption to your puzzles to make them more attractive.

When you tap the upload puzzle you will get a nice uploading view indicating the progress, in this view you can choose to cancel the upload or continue using the app while uploading.

Solved Puzzles View

Solvedpuzzlers

From the Left Menu you can open the Solved puzzles View, and this is where you find the puzzles you successfully solved. You can tap on each puzzle and save and/or the share the solved puzzle.

you can also heart/unheart the puzzle and check the user behind it profile.

Profile Page

This is where you can see your profile and edit your profile image or edit your Name.

When you visit other users’ profile pages you can Follow them and check their puzzles as well .

OTHER

There are other features including Reporting a puzzle or user , block other users you don’t want to see their puzzles.

ROADMAP

Am continuously working to improve the App by fixing issues, adding new features and making sure it’s still nice looking and easy to use.

Some of the features am intending to add

iPad Version 

LeaderBoard

Notifications and Notification Center

Private Users

GRID View For showing more puzzles on screen

Private Puzzles Where user can send a private puzzle to another user

Points And Reward Systems By giving points to another actions not only solving the puzzle.


I Hope You enjoy the app , you can install it from here.

Follow Puzzpic on facebook

Follow Puzzpic(@puzz_pic) on twitter

Puzzpic Website

Adding CocoaPod for your library (public/private)

Adding CocoaPod for your library (public/private)

MAC OS, iOS

This post takes you step by step into how to integrate cocoaPods with your library.

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects

Am going to use an open sourced project I made before on github, and add the cocoapods into it. For you to keep up with me.

  1. Create a repository on github.

You need to Sign up first before you can create new repository. Click on the upper right plus button and choose New Repository. For Reference Lets call it YourPod.

The name should be unique, and make sure to add a license file.

2. Clone the repo

clone the repository for github using their App or through command line

git clone https://github.com/<YourAccountName>/YourPod.git

3. Install Cocoapods

From the terminal type

sudo gem install cocoapods

4. Structure Folders

cd to the folder where you cloned YourPod repository.

Let’s create 2 folders one called YourPod, and the other called Demo.

  • Add your library swift files under YourPod
  • Create an xcode project under Demo Folder
  • Commit Your Changes
  • Push them to github

CREATE THE POD

Before creating the pod. From your repository github page.

  • Click on releases
  • Click on Add release button
  • set the version to be 0.0.1 (this is important, you can set it to any number you want )
  1. Create podspec

From terminal, type

pod spec create YourPod

that will create a podspec file. Open it using xcode or any editor you like.

After you open it, it will look like this ( after removing comments and leaving most of the required attributes)

Pod::Spec.new do |s|
s.name = “YourPod”
s.version = “0.0.1”
s.summary = “A simple HUD to indicate activity, success, and failure.”
s.description = <<-DESC
You can use this Library as a loading indicator while waiting for response from api, you can mention failure and success as well
DESC
s.homepage = “Your project home page "
s.license = { :type => “MIT”, :file => “LICENSE” }
s.author = { “Your Name” => “Your Email” }
s.social_media_url = “http://twitter.com/dark_torch(can be any link)"
s.platform = :ios
s.source = { :git => “https://github.com/YourAccountName/YourPod.git", :tag => s.version.to_s }
s.source_files = “YourPod/*.swift”
s.resources = “YourPod/*.storyboard”, “YourPod/*.xcassets”
s.requires_arc = true
# s.dependency “JSONKit”, “~> 1.4”
end

The license file should be available on the remote repository (e.g. github repo) and belongs to the release you mention in the podspecs file

2. Validate the podspec

From terminal run

pod spec lint YourPod.podspec --verbose

On success you will get “YourPod.podspec passed validation.”, watchout for any warning or error* — verbose is for more detailed logs which should help you if there is any.

3. register the pod in the CocoaPods repo

Now we have our pod validated, we need to push it into cocoapods so others and we can use it. To do that first we need to declare ownership. Simple run this command in terminal from the same directory of the pod.

pod trunk register <YUOREMAIL> ‘<YOUR NAME>’ — description=’owner from macbook pro’

you will get this response

[!] Please verify the session by clicking the link in the verification email that has been sent to <your email>

you should get an email with the validation link within a minute.(It might goes to the spam folder)

4. Upload your pod

Now all we need is to push our pod, simple use this command from terminal.

pod trunk push YourPod.podspec

you should get “ — March 16th, 04:08: Push for `Your pod’ has been pushed (2.792570047 s).” alike message in the terminal.

“if you added your twitter account in the podspec, you will get mentioned in an auto-generated cocoapod new pod tweet ”

TRY IT

Now lets try it

  • Create a Podfile in the same directory where your demo.xcodeproj is.

Your pod may look like this

platform :ios, "8.0"
use_frameworks!
target :Demo do
pod "YOURPOD"
end

if your pod in swift you need to add use_frameworks!

now run

pod install

It will download the pod and create an xcworkspace for you .

Now use demo.xcworkspace , import the pod into your demo and try it.

PRIVATE PODS

you can use a private pod as well although you need few more steps.

  1. Create your own specs repository (where the pod’s podspec file is going to be hosted) (lets call it myspec)
  2. create new folder locally and copy the pod you made before and podspec file.

3. Create new repository for your pod on e.g. bitbucket and upload the files like we did before don’t forget to tag it, you can do it by running

git tag 0.1

and push the tags using

git push -u origin —- tags

4. Add Your specs repository

pod repo add <yourSpecsName> <yourPodRepoDirectory>
e.g.
pod repo add myspec https://bitbucket.org/moath/mospecs

5. Now in your podspec file change the version and source url (it’s better to use https) (Validate as we did before), then push it using >

e.g.

pod repo push myspec MOHUD.podspec — verbose

6. finally in the Podfile add source to refer to your specs repo.

e.g.

source "https://bitbucket.org/moath_torch/mospecs/"
source 'https://github.com/CocoaPods/Specs.git'
##Note: you need to add all resources

Thats should be it .

WRAP UP

Now your Pod should be searchable in https://cocoapods.org/ (if its public)

a nice thing about it is that they will rate your pod based on some metrics like documentation, it worth looking at it and trying to improve your rate.

I hope this helps someone, if you have any comment please add it.

And Thank you for reading.

Links

you can find more detailed info at Cocoapods

Lesson Learnt : UItableView Header always appearing

This is just something I faced tonight

I have a UITableView with PLAIN Style

in the dataSource the sectionNumbers is “1” I swear !!

when I run it into simluator the tableView is shifted down by some 20 pixils !!

The first thing came to my mind is to go and check it on the Interface builder
and from the ‘Size inspector” there is a property called ‘section height ‘ which set by default to ’22’
So yay I just need to change it to 0 and thats it, and thats what I did :
I typed 0 in the field and pressed a BIG Enter problem SOLVED 😀 .. but wait !!!
its not set to 0 !!, instead its 1 …tried again , maybe i just missed the zero the first time !!
but it insists to not to leave the ‘1’ , well ‘I said’ nobody cares about the extra pixil down .
ran it and everything looks OK … or better at least …
my freacking “consciousness” kept tingling me :/ ‘ I need to fix it ,and whyyyyy this happens’

So I took a look at the code and I found that this class is a subclass of another that handle the tableView Delegate ( srsly don’t do alot of subclassing , things may become messy )
SOO I found this code somewhere

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    UIView *header = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 0)];
    
    return  header;
}

mmmmm looks I was trying to add some section header but then I didn’t, but wait !!
ok there is a bad non necessary method here but the ‘height’ is zero and there is no really a header …
although am getting the 22 height empty header on screen !!

srsly I dunno , but deleting this method removed the 1 pixil header … 🙂

OK OK I went to the ducomentation and I read this ( again ‘consciousness’)
This method only works correctly when tableView:heightForHeaderInSection: is also implemented.”
only !! 
so looks if we implemented the ‘viewForHeaderInSection’ no matter what object it returns the ‘section Height’ will be set to 22 as a default value .. unless we implement the  ‘tableView:heightForHeaderInSection: ‘ method WHICH I did not …
but why in the size inpector I couldn’t set it to 0 !!! .. 

Well, I guess it will remain as a mystery .. one little mystery for tonight.. 🙂

P.S. for some reason there is no spelling checker and yeah there will be speeling errorss

Custom back button in UINavigationController

Snippet From Apple sample Code

UIImage *backButtonBackgroundImage = [UIImage imageNamed:@”back”];
    // The background should be pinned to the left and not stretch.
  float margin = 12.0;
    backButtonBackgroundImage = [backButtonBackgroundImage resizableImageWithCapInsets:UIEdgeInsetsMake(0, backButtonBackgroundImage.size.width – margin, 0, 0)];
    id appearance = [UIBarButtonItem appearanceWhenContainedIn:[
CustomBackButtonNavController class], nil];
    [appearance setBackButtonBackgroundImage:backButtonBackgroundImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
    UIBarButtonItem *backBarButton = [[UIBarButtonItem alloc] initWithTitle:@” ” style:UIBarButtonItemStylePlain target:nil action:nil];
    self.navigationItem.backBarButtonItem = backBarButton;

Just one note : the image you use may have different size an though needs different margin Value ;

Just another: CustomBackButtonNavController   can be replaced with UINavigationController in case you are using the same back button all over the app as in my most cases 🙂 .

Presenting ViewController from UIAlertView (Attempt to present on which is already presenting )

Presenting ViewController from UIAlertView
Something I face this morning which was annoying ,is That I was trying to present a ViewController
After user Tap on a UIAlertView button.
The result was this console log !!
uialertview Warning: Attempt to present <_UIModalItemsPresentingViewController: > on <_UIModalItemAppViewController:  > which is already presenting”
The Code I was using looked like this : 
UIAlertView * alert =[[[UIAlertView alloc] initWithTitle:TITLE
message:MSG
delegate:Dgt
cancelButtonTitle:@“OK”
otherButtonTitles:nil] show];
And in The AlertView Delegate  I called presentViewController
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    
     MOImageViewController    *_imageVC =[[UIStoryboard storyboardWithName:@”Main” bundle:nilinstantiateViewControllerWithIdentifier:@”imageScreen”];
                    
                    [_imageVC setImageURLString:urlString];
                    
                     
                    // topViewController  
                    [[self topViewController] presentViewController:_imageVC animated:YES completion:Nil];

}
What turned out is that UIAlertView is treated like viewController and upon clicking at one of its Buttons it gets dismissed, So in the previous code am presenting a new viewController while dismissing the AlertView Which gives me the mentioned warning .
The simplest solution for this is simply using another AlertView Delegate which is 
-(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{
 // presenting view controller here safely
Thats it 🙂