How to create and use the iOS Framework to exchange codes with extensions

What does minimal setup and use of the iOS user infrastructure look like? I'm starting to learn this to share code with the Today extension.

Here is what I have done so far

  • Added a new Target that selects a Cocoa Touch Framework template called TesterKit
  • Inside the frame, I created a new class TestClass.swift
  • Inside TestClass.swift, I created a simple class class fund tester () to print a string for testing

Looking at my application, I see that TesterKit is added as Embedded binaries and Related structures and libraries , however it is red

  1. To use this new Framework in the application, I added import TesterKit to the top of my AppDelegate
  2. Then I tried to call the class method from Framework using TestClass.tester (). But instead of showing a log message, I get ...

    "Using an unresolved identifier"

→ What am I doing wrong? Any wrong assumptions here?

Note. I already watched the WWDC 416 session “Creating Modern Frames” and found the Framework Programmign Guide . If there are examples of projects showing how to use such new custom iOS platforms, ideally, using Swift +, integrating it with Today Extensions, this can also be useful.

+5
source share
1 answer

Your import does not seem to fail, which means that the structure is really configured correctly ... try making the function public .

public func tester() { print("tester()" } 
+2
source

Source: https://habr.com/ru/post/1202434/


All Articles