Skip to content

tvOS support #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 42 commits into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
fd913af
Fixed example
RomanPodymov Nov 24, 2019
b01b964
Update README.md
RomanPodymov Nov 24, 2019
91eb178
tvOS
RomanPodymov Nov 24, 2019
6a6c209
Update SPPermissionsColor.swift
RomanPodymov Nov 24, 2019
688c85c
Update SPPermissionsHaptic.swift
RomanPodymov Nov 24, 2019
b56650b
Update SPPermissionsText.swift
RomanPodymov Nov 24, 2019
2428ade
Update SPPermissionsDialogController.swift
RomanPodymov Nov 24, 2019
cbd9afa
Update SPPermissionsListController.swift
RomanPodymov Nov 24, 2019
85e796b
Update SPPermissionIconView.swift
RomanPodymov Nov 24, 2019
b2c06e2
Update SPPermission.swift
RomanPodymov Nov 24, 2019
96c74c7
Update SPPermissionLocation.swift
RomanPodymov Nov 24, 2019
ee01814
Update SPRequestPermissionLocationHandler.swift
RomanPodymov Nov 24, 2019
3554ab8
Calendar for iOS only
RomanPodymov Nov 24, 2019
3a58cd1
Update SPPermissions.podspec
RomanPodymov Nov 24, 2019
1f493d4
Update SPPermissionsText.swift
RomanPodymov Nov 24, 2019
947abab
Update SPPermissionIconView.swift
RomanPodymov Nov 24, 2019
7fe4c3f
Update SPPermission.swift
RomanPodymov Nov 24, 2019
ef5c17f
Update SPPermissionCalendar.swift
RomanPodymov Nov 24, 2019
9663089
Update SPPermissionCamera.swift
RomanPodymov Nov 24, 2019
54769bc
Update SPPermissionContacts.swift
RomanPodymov Nov 24, 2019
e80b249
Update SPPermissionMediaLibrary.swift
RomanPodymov Nov 24, 2019
57f2ae9
Update SPPermissionMicrophone.swift
RomanPodymov Nov 24, 2019
5a66417
Update SPPermissionMotion.swift
RomanPodymov Nov 24, 2019
ce143bb
Update SPPermissionNotification.swift
RomanPodymov Nov 24, 2019
31508b1
Update SPPermissionReminders.swift
RomanPodymov Nov 24, 2019
5e73c8c
Update SPPermissionSpeech.swift
RomanPodymov Nov 24, 2019
be3a18d
tvOS example
RomanPodymov Nov 24, 2019
6a3ed92
tvOS framework
RomanPodymov Nov 24, 2019
2e7fbf3
schemes
RomanPodymov Nov 24, 2019
acdac61
tvOS 11
RomanPodymov Nov 24, 2019
9a5a51f
Update ViewController.swift
RomanPodymov Nov 24, 2019
f897b7f
Configurations
RomanPodymov Nov 24, 2019
4a763f9
Update Info.plist
RomanPodymov Nov 24, 2019
d8117fa
Update ViewController.swift
RomanPodymov Nov 25, 2019
edc30b7
Update SPPermissions.swift
RomanPodymov Nov 25, 2019
698d089
Update SPPermissionsDialogController.swift
RomanPodymov Nov 25, 2019
1aad69c
Update SPPermissionsDialogFooterCommentView.swift
RomanPodymov Nov 25, 2019
647e48e
Update SPPermissionsDialogView.swift
RomanPodymov Nov 25, 2019
d73bd3b
Update SPPermissionsListController.swift
RomanPodymov Nov 25, 2019
7d97347
Update SPPermissionsListFooterCommentView.swift
RomanPodymov Nov 25, 2019
96caeb4
Update SPPermissionsListHeaderView.swift
RomanPodymov Nov 25, 2019
6e0fcb2
Update ViewController.swift
RomanPodymov Nov 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@ class ViewController: UITableViewController {

var allPermissions: [SPPermission] = SPPermission.allCases
var selectedPermissions: [SPPermission] = []
#if os(iOS)
let segmentedControlItems = ["List", "Dialog", "Native"]
#else
let segmentedControlItems = ["Native"]
#endif

init() {
#if os(iOS)
if #available(iOS 13.0, *) {
super.init(style: .insetGrouped)
} else {
super.init(style: .plain)
}
#else
super.init(style: .plain)
#endif
}

required init?(coder: NSCoder) {
Expand All @@ -21,27 +30,31 @@ class ViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.title = "Choose Style"
let segmentedControl = UISegmentedControl(items: ["List", "Dialog", "Native"])
let segmentedControl = UISegmentedControl(items: segmentedControlItems)
navigationItem.titleView = segmentedControl
segmentedControl.selectedSegmentIndex = 0
navigationItem.rightBarButtonItem = UIBarButtonItem.init(barButtonSystemItem: .play, target: self, action: #selector(self.requestPermissions))
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .play, target: self, action: #selector(self.requestPermissions))
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
}

@objc func requestPermissions() {
if selectedPermissions.isEmpty { return }
guard let segmentControl = navigationItem.titleView as? UISegmentedControl else { return }
switch segmentControl.selectedSegmentIndex {
case 0:
#if os(iOS)
case segmentedControlItems.firstIndex(of: "List"):
let controller = SPPermissions.list(selectedPermissions)
controller.dataSource = self
controller.present(on: self)
case 1:
case segmentedControlItems.firstIndex(of: "Dialog"):
let controller = SPPermissions.dialog(selectedPermissions)
controller.dataSource = self
controller.present(on: self)
case 2:
break
#endif
case segmentedControlItems.firstIndex(of: "Native"):
let controller = SPPermissions.native(selectedPermissions)
controller.dataSource = self
controller.present(on: self)
default:
break
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"layers" : [
{
"filename" : "Front.imagestacklayer"
},
{
"filename" : "Middle.imagestacklayer"
},
{
"filename" : "Back.imagestacklayer"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"layers" : [
{
"filename" : "Front.imagestacklayer"
},
{
"filename" : "Middle.imagestacklayer"
},
{
"filename" : "Back.imagestacklayer"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"assets" : [
{
"size" : "1280x768",
"idiom" : "tv",
"filename" : "App Icon - App Store.imagestack",
"role" : "primary-app-icon"
},
{
"size" : "400x240",
"idiom" : "tv",
"filename" : "App Icon.imagestack",
"role" : "primary-app-icon"
},
{
"size" : "2320x720",
"idiom" : "tv",
"filename" : "Top Shelf Image Wide.imageset",
"role" : "top-shelf-image-wide"
},
{
"size" : "1920x720",
"idiom" : "tv",
"filename" : "Top Shelf Image.imageset",
"role" : "top-shelf-image"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
},
{
"idiom" : "tv-marketing",
"scale" : "1x"
},
{
"idiom" : "tv-marketing",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
},
{
"idiom" : "tv-marketing",
"scale" : "1x"
},
{
"idiom" : "tv-marketing",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
6 changes: 6 additions & 0 deletions Example tvOS/App/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
24 changes: 24 additions & 0 deletions Example tvOS/App/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="13122.16" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="wu6-TO-1qx"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
Loading