Skip to content

Commit

Permalink
demoapp/swift_initial_implementation (#4)
Browse files Browse the repository at this point in the history
* Project setup

* WIP

* Add SdkKey in info.plist

* Update ALAppDelegate.swift

* Fix black screen

* More fixes

* Storyboard

* Update Main.storyboard

* Parallel objc demo app changes

* Remove test ad unit id

* Remove sdk key

* Delete IDEWorkspaceChecks.plist

* Delete IDEWorkspaceChecks.plist

* Pod deintegrate pbxproj file

* Update .gitignore

* Force unwrap SDK in AppDelegate

* Inline initialization of ad objects, remove if let checks
  • Loading branch information
tiandrew authored Sep 30, 2019
1 parent 81ac0b2 commit ab0edf4
Show file tree
Hide file tree
Showing 20 changed files with 1,258 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ DerivedData/
xcuserdata/
xcworkspace/
*.xcworkspacedata
DemoApp-ObjC/DemoApp-ObjC.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
*IDEWorkspaceChecks.plist

## Other
*.moved-aside
Expand Down
2 changes: 1 addition & 1 deletion DemoApp-ObjC/DemoApp-ObjC/ALHomeViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

#import <UIKit/UIKit.h>

@interface ALHomeViewController : UIViewController
@interface ALHomeViewController : UITableViewController

@end
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ - (void)viewDidLoad
{
[super viewDidLoad];

self.adView = [[MAAdView alloc] initWithAdUnitIdentifier: @"BANNER_AD_UNIT_ID"];
self.adView = [[MAAdView alloc] initWithAdUnitIdentifier: @"YOUR_AD_UNIT_ID"];
self.adView.delegate = self;
self.adView.translatesAutoresizingMaskIntoConstraints = NO;

// Set background or background color for banners to be fully functional
self.adView.backgroundColor = UIColor.blackColor;

[self.view addSubview: self.adView];

// Center the banner and anchor it to the top of the screen.
CGFloat height = (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) ? 90 : 50; // Banner height on iPhone and iPad is 50 and 90, respectively
[self.view addConstraints: @[[self constraintWithAdView: self.adView andAttribute: NSLayoutAttributeLeading],
Expand All @@ -40,15 +42,14 @@ - (void)viewDidLoad
attribute: NSLayoutAttributeNotAnAttribute
multiplier: 1.0
constant: height]]];
[self.view addSubview: self.adView];

// Load the first ad
[self.adView loadAd];
}

- (NSLayoutConstraint *)constraintWithAdView:(MAAdView *)adView andAttribute:(NSLayoutAttribute)attribute
{
return [NSLayoutConstraint constraintWithItem: self.adView
return [NSLayoutConstraint constraintWithItem: adView
attribute: attribute
relatedBy: NSLayoutRelationEqual
toItem: self.view
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="7Ga-dD-PKi">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="7Ga-dD-PKi">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Home View Controller-->
<scene sceneID="kUz-88-3U0">
<objects>
<tableViewController id="Xhz-da-ENL" customClass="ALHomeViewController" customModule="DemoApp_ObjC" customModuleProvider="target" sceneMemberID="viewController">
<tableViewController id="Xhz-da-ENL" customClass="ALHomeViewController" sceneMemberID="viewController">
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="qUe-EF-iqJ">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand All @@ -26,11 +24,11 @@
<rect key="frame" x="0.0" y="55.5" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="gnk-Wm-cnP" id="UDo-Oe-dll">
<rect key="frame" x="0.0" y="0.0" width="376" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="382.5" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Interstitials" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="8le-fN-BRS">
<rect key="frame" x="20" y="0.0" width="356" height="43.5"/>
<rect key="frame" x="20" y="0.0" width="354.5" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
Expand All @@ -46,11 +44,11 @@
<rect key="frame" x="0.0" y="99.5" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="sjX-rW-J4x" id="haN-UP-4gB">
<rect key="frame" x="0.0" y="0.0" width="376" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="382.5" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Rewarded" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="jwg-iU-PjM">
<rect key="frame" x="20" y="0.0" width="356" height="43.5"/>
<rect key="frame" x="20" y="0.0" width="354.5" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
Expand All @@ -66,11 +64,11 @@
<rect key="frame" x="0.0" y="143.5" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="McN-1s-PdH" id="uDH-cj-B6x">
<rect key="frame" x="0.0" y="0.0" width="376" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="382.5" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Auto Layout Banners / Leaders" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="sqm-jN-17q">
<rect key="frame" x="20" y="0.0" width="356" height="43.5"/>
<rect key="frame" x="20" y="0.0" width="354.5" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
Expand All @@ -86,11 +84,11 @@
<rect key="frame" x="0.0" y="187.5" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="4rA-1a-Qdu" id="rWL-gK-Qk7">
<rect key="frame" x="0.0" y="0.0" width="376" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="382.5" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Frame Layout Banners / Leaders" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="qEz-dE-EJ6" userLabel="Frame Layout Banners / Leaders">
<rect key="frame" x="20" y="0.0" width="356" height="43.5"/>
<rect key="frame" x="20" y="0.0" width="354.5" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
Expand All @@ -106,11 +104,11 @@
<rect key="frame" x="0.0" y="231.5" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Sj2-mt-y69" id="DVy-il-4Jg">
<rect key="frame" x="0.0" y="0.0" width="376" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="382.5" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Interface Builder Banners / Leaders" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="ibI-wO-fLO">
<rect key="frame" x="20" y="0.0" width="356" height="43.5"/>
<rect key="frame" x="20" y="0.0" width="354.5" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
Expand Down
4 changes: 2 additions & 2 deletions DemoApp-ObjC/DemoApp-ObjC/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppLovinSdkKey</key>
<string>SDK_KEY_HERE</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
Expand Down Expand Up @@ -43,7 +45,5 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>AppLovinSdkKey</key>
<string>SDK_KEY_HERE</string>
</dict>
</plist>
Loading

0 comments on commit ab0edf4

Please sign in to comment.