Minor tweaks

This commit is contained in:
Sindre Sorhus 2021-03-25 00:58:32 +07:00
parent 8a326d3e42
commit 0cde550694
3 changed files with 20 additions and 35 deletions

View File

@ -1,7 +1,6 @@
whitelist_rules: only_rules:
- anyobject_protocol - anyobject_protocol
- array_init - array_init
- attributes
- block_based_kvo - block_based_kvo
- class_delegate_protocol - class_delegate_protocol
- closing_brace - closing_brace
@ -12,6 +11,7 @@ whitelist_rules:
- colon - colon
- comma - comma
- compiler_protocol_init - compiler_protocol_init
- computed_accessors_order
- conditional_returns_on_newline - conditional_returns_on_newline
- contains_over_filter_count - contains_over_filter_count
- contains_over_filter_is_empty - contains_over_filter_is_empty
@ -21,6 +21,7 @@ whitelist_rules:
- custom_rules - custom_rules
- deployment_target - deployment_target
- discarded_notification_center_observer - discarded_notification_center_observer
- discouraged_assert
- discouraged_direct_init - discouraged_direct_init
- discouraged_object_literal - discouraged_object_literal
- discouraged_optional_boolean - discouraged_optional_boolean
@ -35,7 +36,7 @@ whitelist_rules:
- empty_parentheses_with_trailing_closure - empty_parentheses_with_trailing_closure
- empty_string - empty_string
- empty_xctest_method - empty_xctest_method
- enum_case_associated_value_count - enum_case_associated_values_count
- explicit_init - explicit_init
- fallthrough - fallthrough
- fatal_error_message - fatal_error_message
@ -43,10 +44,12 @@ whitelist_rules:
- flatmap_over_map_reduce - flatmap_over_map_reduce
- for_where - for_where
- generic_type_name - generic_type_name
- ibinspectable_in_extension
- identical_operands - identical_operands
- identifier_name - identifier_name
- implicit_getter - implicit_getter
- implicit_return - implicit_return
- inclusive_language
- inert_defer - inert_defer
- is_disjoint - is_disjoint
- joined_default_parameter - joined_default_parameter
@ -75,18 +78,17 @@ whitelist_rules:
- notification_center_detachment - notification_center_detachment
- nsobject_prefer_isequal - nsobject_prefer_isequal
- number_separator - number_separator
- object_literal
- opening_brace - opening_brace
- operator_usage_whitespace - operator_usage_whitespace
- operator_whitespace - operator_whitespace
- orphaned_doc_comment - orphaned_doc_comment
- overridden_super_call - overridden_super_call
- pattern_matching_keywords
- prefer_self_type_over_type_of_self - prefer_self_type_over_type_of_self
- prefer_zero_over_explicit_init
- private_action - private_action
- private_outlet - private_outlet
- private_subject
- private_unit_test - private_unit_test
- prohibited_nan_comparison
- prohibited_super_call - prohibited_super_call
- protocol_property_accessors_order - protocol_property_accessors_order
- reduce_boolean - reduce_boolean
@ -100,7 +102,6 @@ whitelist_rules:
- redundant_type_annotation - redundant_type_annotation
- redundant_void_return - redundant_void_return
- required_enum_case - required_enum_case
- return_value_from_void_function
- return_arrow_whitespace - return_arrow_whitespace
- shorthand_operator - shorthand_operator
- sorted_first_last - sorted_first_last
@ -112,13 +113,13 @@ whitelist_rules:
- switch_case_on_newline - switch_case_on_newline
- syntactic_sugar - syntactic_sugar
- todo - todo
- test_case_accessibility
- toggle_bool - toggle_bool
- trailing_closure - trailing_closure
- trailing_comma - trailing_comma
- trailing_newline - trailing_newline
- trailing_semicolon - trailing_semicolon
- trailing_whitespace - trailing_whitespace
- tuple_pattern
- unavailable_function - unavailable_function
- unneeded_break_in_switch - unneeded_break_in_switch
- unneeded_parentheses_in_closure_argument - unneeded_parentheses_in_closure_argument
@ -141,30 +142,11 @@ whitelist_rules:
- xctfail_message - xctfail_message
- yoda_condition - yoda_condition
analyzer_rules: analyzer_rules:
- capture_variable
- unused_declaration - unused_declaration
- unused_import - unused_import
force_cast: warning
force_try: warning
force_unwrapping: warning
number_separator: number_separator:
minimum_length: 5 minimum_length: 5
object_literal:
image_literal: false
discouraged_object_literal:
color_literal: false
type_contents_order:
order:
- case
- [type_alias, associated_type, subtype]
- type_property
- type_method
- ib_outlet
- [ib_inspectable, instance_property]
- initializer
- deinitializer
- subscript
- view_life_cycle_method
- [ib_action, other_method]
identifier_name: identifier_name:
max_length: max_length:
warning: 100 warning: 100
@ -185,7 +167,7 @@ identifier_name:
- 'y1' - 'y1'
- 'y2' - 'y2'
deployment_target: deployment_target:
macOS_deployment_target: '10.12' macOS_deployment_target: '10.13'
custom_rules: custom_rules:
no_nsrect: no_nsrect:
regex: '\bNSRect\b' regex: '\bNSRect\b'

View File

@ -8,6 +8,7 @@ public final class Aperture: NSObject {
case couldNotAddScreen case couldNotAddScreen
case couldNotAddMic case couldNotAddMic
case couldNotAddOutput case couldNotAddOutput
case couldNotSetVideoCodec
} }
private let destination: URL private let destination: URL
@ -63,11 +64,13 @@ public final class Aperture: NSObject {
throw Error.couldNotAddOutput throw Error.couldNotAddOutput
} }
// TODO: Default to HEVC when encoding is hardware supported. Without hardware encoding I got 3 FPS full screen recording. if
// TODO: Find a way to detect hardware encoding support. let videoCodec = videoCodec,
// Hardware encoding is supported on 6th gen Intel processor or newer. let connection = output.connection(with: .video)
if let videoCodec = videoCodec { {
output.setOutputSettings([AVVideoCodecKey: videoCodec], for: output.connection(with: .video)!) output.setOutputSettings([AVVideoCodecKey: videoCodec], for: connection)
} else {
throw Error.couldNotSetVideoCodec
} }
super.init() super.init()

View File

@ -12,7 +12,7 @@
## Install ## Install
#### SwiftPM #### Swift Package Manager
```swift ```swift
.package(url: "https://github.com/wulkano/Aperture", from: "0.4.0") .package(url: "https://github.com/wulkano/Aperture", from: "0.4.0")