-
Notifications
You must be signed in to change notification settings - Fork 143
Add tvOS support #263
base: master
Are you sure you want to change the base?
Add tvOS support #263
Conversation
Generated by 🚫 danger |
Current coverage is 93.11% (diff: 36.66%)@@ master #263 diff @@
========================================
Files 72 72
Lines 5019 5042 +23
Methods 0 0
Messages 0 0
Branches 0 0
========================================
+ Hits 0 4695 +4695
+ Misses 5019 347 -4672
Partials 0 0
|
@@ -1849,6 +1849,7 @@ - (void)testRenderingUpdatesContentInsetBeforeAndAfterRendering | |||
|
|||
- (void)testProposedContentInsetIsDefaultIfHeaderMissing | |||
{ | |||
#if !TARGET_OS_TV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this encompass the whole test (including the method signature) as with testAdaptingOverlayComponentCenterPointToKeyboard
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice stuff! 😺
You might also be interested in @JohnSundell’s pass at the same task: master...JohnSundell:tvos
I haven’t look that much at the linked code. Main difference I know about it that the framework is universal. I.e. the same target is used for both iOS and tvOS. Not sure which approach we want though. Xcode doesn’t seem to like multi-platform targets, showing way to many destinations in the build device destination dropdown menu,
344C5F101E09CF9A00597B61 /* Debug */ = { | ||
isa = XCBuildConfiguration; | ||
buildSettings = { | ||
ALWAYS_SEARCH_USER_PATHS = NO; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We keep all of these settings in our spotify_os.xcconfig
file. Could you instead set the target to use the project.xcconfig
file and then remove all of these overrides.
Unless a config option is specifically required for a framework or differs from the normal xcconfig. We’ll later look into moving those values to an xcconfig as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally had the chance to look into this. So... I basically just duplicated the setup of the current HubFramework-iOS dynamic target and made my tvOS modifications. All of these overrides are currently in production.
I will make this modification to both dynamic targets then.
344C5F111E09CF9A00597B61 /* Release */ = { | ||
isa = XCBuildConfiguration; | ||
buildSettings = { | ||
ALWAYS_SEARCH_USER_PATHS = NO; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for release as for debug :)
SDKROOT = appletvos10.1; | ||
SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; | ||
WARNING_CFLAGS = ( | ||
"$(inherited)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here as for the debug commands (remove overrides and use xcconfig values).
INFOPLIST_FILE = "$(SRCROOT)/sources/Info.plist"; | ||
PRODUCT_BUNDLE_IDENTIFIER = com.spotify.HubFrameworkTests; | ||
PRODUCT_NAME = "$(TARGET_NAME)"; | ||
SDKROOT = appletvos10.1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be set to just appletvos
, right? Since we want to always use the latests SDK to build with.
buildSettings = { | ||
HUB_NON_ERROR_WARNINGS_0720 = ""; | ||
HUB_NON_ERROR_WARNINGS_0730 = "$(HUB_NON_ERROR_WARNING_0720) -Wno-error=partial-availability"; | ||
INFOPLIST_FILE = "$(SRCROOT)/sources/Info.plist"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn’t we use Info-tvOS.plist
?
#import "HUBComponent.h" | ||
|
||
/// Enum defining various focus states that a component can be in | ||
typedef NS_ENUM(NSUInteger, HUBComponentFocusState) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NS_ENUM
should use NSInteger
as the backing value, unless there’s a specific reason for it being unsigned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Erm... I was just being consistent with most of the other NS_ENUMs in the project (see HUBComponentSelectionState, HUBActionTrigger, HUBComponentLayoutContentEdge, HUBComponentType, HUBConnectivityState etc).
There's no specific reason I can think of for any of them to be unsigned. Should we change all enums?
Thanks for the feedback. A universal framework is much easier to maintain and that's a huge plus. The main technical argument against a universal framework was that Carthage couldn't build it but that's no longer the case. See these for context: Any other argument we should consider in favour of a platform-specific framework? An additional difference with @JohnSundell's implementation is that I added an explicit HubComponentWithFocusState protocol whereas John merged focus state with highlighted state. I will update the PR with the changes requested by @rastersize and @cerihughes and will steal a couple of ideas from @JohnSundell's branch 😄 |
@marmelroy Thank you for the links and update, much appreciated! From reading the Alamofire discussions I think we should probably go with multiple targets. Like you’ve done in this PR. |
Sorry for the delay in fixing this - moving countries is quite time exhaustive. This PR should be ready for another review (cc @cerihughes, @rastersize ). Summary of changes:
Note: |
I would prefer we wait with this until we have the API more stable, we also need to refactor |
Fixes https://github.com/spotify/HubFramework/issues/164.
There are several things going on here:
Missing: