DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Building a Simple Todo App With Model Context Protocol (MCP)
  • Mastering React App Configuration With Webpack
  • How to Build a React Native Chat App for Android
  • How to Build Slack App for Audit Requests

Trending

  • How to Build Scalable Mobile Apps With React Native: A Step-by-Step Guide
  • A Modern Stack for Building Scalable Systems
  • Artificial Intelligence, Real Consequences: Balancing Good vs Evil AI [Infographic]
  • Comparing SaaS vs. PaaS for Kafka and Flink Data Streaming

My First Native iOS App: Death Clock

By 
Raymond Camden user avatar
Raymond Camden
·
Apr. 02, 14 · Interview
Likes (0)
Comment
Save
Tweet
Share
3.0K Views

Join the DZone community and get the full member experience.

Join For Free

A few days ago I returned from a week of Objective-C and iOS training. I wanted to build an app on my own just to see what I could do and how comfortable I felt with the technology away from the Nerd Ranch. While it isn't pretty and the code is probably wrong in multiple ways, I've been able to create a native version of the Death Clock.

I used a UINavigationController to handle my views. I like the simple push, pop architecture and that you can disable the navigation bar. I wanted a "full screen" view for my application so that was important. The application is split into two sections. The initial screen is a simple config.

For the application I decided to only use birthdate and not gender. I wish there was a bit more control over the data picker widget. It seems huge to me. I spent about 30 seconds on the button so pardon the low tech look. The application also makes use of NSUserDefaults to record your birthdate for future loads. Want to see what this screen looks like? Check it out:

//
//  RKCConfigViewController.m
//  Death Clock
//
//  Created by Raymond Camden on 3/24/14.
//  Copyright (c) 2014 Raymond Camden. All rights reserved.
//

#import "RKCConfigViewController.h"
#import "RKCDeathClockViewController.h"

@interface RKCConfigViewController()

@property (nonatomic, weak) IBOutlet UIDatePicker *birthdayPicker;
@property (nonatomic, weak) IBOutlet UIButton *startDeathClock;
@property (nonatomic, strong) NSDate *birthday;

@end

@implementation RKCConfigViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    
    if (self) {
        //check for default
        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        NSDate *defaultBD = [defaults objectForKey:@"Birthday"];
        NSLog(@"%@", defaultBD);
        if(defaultBD) _birthday = defaultBD;
        else _birthday = [[NSDate alloc] init];
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    //no times, just m/d/y
    _birthdayPicker.datePickerMode = UIDatePickerModeDate;
    _birthdayPicker.date = _birthday;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    //you weren't born in the future
    self.birthdayPicker.maximumDate = [[NSDate alloc] init];
    //set an initial data
    _birthday = [[NSDate alloc] init];
}

- (IBAction)setBirthDay:(id)sender
{
    _birthday = self.birthdayPicker.date;
    NSLog(@"Set bday for %@", self.birthday);

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:_birthday forKey:@"Birthday"];

}

- (IBAction)startDeathClock:(id)sender
{
    NSLog(@"CLICK ME BABY");
    RKCDeathClockViewController *dvc = [[RKCDeathClockViewController alloc] init];
    dvc.birthday = _birthday;
    [self.navigationController pushViewController:dvc animated:NO];
}

@end

The second view is the actual counter. This isn't terribly exciting. I've got the actual death date and then the number of seconds.

And that's it. Want to see all the code? I created a new GitHub repo so I could store my examples. To be clear, do not consider this anything near "good" iOS programming. I just wanted to share.

Objective-C Examples

Later this week I think I may try to get this into the App Store. I figure I don't have much chance of it being accepted, but it can't hurt, right?

app Clock (cryptography)

Published at DZone with permission of Raymond Camden, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Building a Simple Todo App With Model Context Protocol (MCP)
  • Mastering React App Configuration With Webpack
  • How to Build a React Native Chat App for Android
  • How to Build Slack App for Audit Requests

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!