Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7641883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:02:36+00:00 2026-05-31T09:02:36+00:00

This a very basic question but I’ve searched all over and been unable to

  • 0

This a very basic question but I’ve searched all over and been unable to find an answer that explains well enough for me to get my head around it.

What I want to do is create a method in one class of my iOS app and then call that method from other classes in my app. Could someone explain exactly what I need to do to achieve this? Any help would be greatly appreciated as all my attempts so far have failed!

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:02:37+00:00Added an answer on May 31, 2026 at 9:02 am

    Objective-C:

    You have to import the header of the class that contains the method you want to use (ClassYouWantToUse.h) into the class you want to use it at (TargetClass).

    Inside the TargetClass.h or TargetClass.m (depending on the scope you want to give it):

    #import "ClassYouWantToUse.h"
    

    Then create an instance of the class you want to use inside the target class either as a property like this:

    @property (nonatomic,strong) ClassYouWantToUse *classObject;
    

    Or as an instance variable like this:

    ClassYouWantToUse *classObject;
    

    Make sure you initialize it! (usually inside ViewDidLoad):

    classObject = [[ClassYouWantToUse alloc] init];
    

    Now you can call any public methods from that class like this:

    [classObject theClassMethodWithParam:param1 andSecondParam:param2];
    

    Note: The ClassYouWantToUse class must have the methods that you want to make accessible to others by declaring them in the header file:

    - (void)theClassMethodWithParam:(UIImage*)someImage andSecondParam:(NSString*)someText;
    

    Otherwise you won’t be able to see these methods.


    Swift:

    Theres really nothing special about it in swift, just adding this as a reference.

    In swift you simply create an instance of the class you want to use:

    let classObject = ClassYouWantToUse()
    

    And use it directly:

    classObject.theClassMethodWithParam(param1, andSecondParam:param2)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a very basic MySQL question but I could not find an answer.
This is a very basic question - but I haven't been able to find
I realise that this is a very basic question, but it is one which
This seems like a very basic question but I couldn't find any help on
I know this is a very basic question, but I haven't been able to
This probably is a very very basic question but i can't seem to find
This could very well be a basic question - but I was unable to
This may seem like a very basic question, but its been in my head
Its a very basic question - but i could not find the answer to
I realise that this must be a very basic question, but my google-fu seems

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.